dynamic-content.html 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <html>
  3. <head>
  4. <title>jquery.slimscroll - dynamic content</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  6. <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
  7. <link href="libs/prettify/prettify.css" type="text/css" rel="stylesheet" />
  8. <script type="text/javascript" src="libs/prettify/prettify.js"></script>
  9. <script type="text/javascript" src="../jquery.slimscroll.js"></script>
  10. <link href="style.css" type="text/css" rel="stylesheet" />
  11. </head>
  12. <body>
  13. <a id="git-fork" href="https://github.com/rochal/jQuery-slimScroll"><img src="https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png" alt="Fork me on GitHub"></a>
  14. <div class="examples">
  15. <div id="testDiv">
  16. </div>
  17. <pre class="prettyprint">
  18. // update content every second
  19. setInterval(function(){
  20. var el = $('&lt;div&gt;&lt;/div&gt;').html('#' + $('#testDiv').children().length)
  21. .css({ padding: '3px', border: '1px solid #ccc', margin: '5px' });
  22. $('#testDiv').append(el);
  23. // update slimscroll every time content changes
  24. $('#testDiv').slimscroll();
  25. }, 1000);
  26. $('#testDiv').slimscroll({
  27. alwaysVisible: true,
  28. height: 150
  29. });
  30. </pre>
  31. </div>
  32. <script type="text/javascript">
  33. $(function(){
  34. // update content every second
  35. setInterval(function(){
  36. var el = $('<div></div>').html('#' + $('#testDiv').children().length)
  37. .css({ padding: '3px', border: '1px solid #ccc', margin: '5px' });
  38. $('#testDiv').append(el);
  39. // update slimscroll every time content changes
  40. $('#testDiv').slimscroll();
  41. }, 1000);
  42. $('#testDiv').slimscroll({
  43. alwaysVisible: true,
  44. height: 150
  45. });
  46. });
  47. </script>
  48. <script type="text/javascript">
  49. //enable syntax highlighter
  50. prettyPrint();
  51. var _gaq = _gaq || [];
  52. _gaq.push(['_setAccount', 'UA-3112455-22']);
  53. _gaq.push(['_setDomainName', 'none']);
  54. _gaq.push(['_trackPageview']);
  55. (function() {
  56. var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
  57. ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
  58. var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  59. })();
  60. </script>
  61. </body>
  62. </html>