dynamic_content.html 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  2. "http://www.w3.org/TR/html4/loose.dtd">
  3. <html>
  4. <head>
  5. <title>jScrollPane - dynamic content demo page</title>
  6. <!-- styles specific to demo site -->
  7. <link type="text/css" href="style/demo.css" rel="stylesheet" media="all" />
  8. <!-- styles needed by jScrollPane - include in your own sites -->
  9. <link type="text/css" href="style/jquery.jscrollpane.css" rel="stylesheet" media="all" />
  10. <style type="text/css" id="page-css">
  11. /* Styles specific to this particular page */
  12. .scroll-pane
  13. {
  14. width: 100%;
  15. height: 200px;
  16. overflow: auto;
  17. }
  18. </style>
  19. <!-- latest jQuery direct from google's CDN -->
  20. <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
  21. <!-- the mousewheel plugin -->
  22. <script type="text/javascript" src="script/jquery.mousewheel.js"></script>
  23. <!-- the jScrollPane script -->
  24. <script type="text/javascript" src="script/jquery.jscrollpane.min.js"></script>
  25. <!-- scripts specific to this demo site -->
  26. <script type="text/javascript" src="script/demo.js"></script>
  27. <script type="text/javascript" id="sourcecode">
  28. $(function()
  29. {
  30. var settings = {
  31. showArrows: true
  32. };
  33. var pane = $('.scroll-pane')
  34. pane.jScrollPane(settings);
  35. var api = pane.data('jsp');
  36. var i = 1;
  37. // Every second add some new content...
  38. setInterval(
  39. function()
  40. {
  41. api.getContentPane().append(
  42. $('<p />').text('This is paragraph number ' + i++)
  43. );
  44. // we could call "pane.jScrollPane(settings)" again but it is
  45. // more convenient to call via the API as then the original
  46. // settings we passed in are automatically remembered.
  47. api.reinitialise();
  48. },
  49. 1000
  50. );
  51. });
  52. </script>
  53. </head>
  54. <body>
  55. <div id="top-nav">
  56. <img src="image/logo.png" width="196" height="69" alt="jScrollPane">
  57. <ul>
  58. <li><a href="index.html">Home</a></li>
  59. <li><a href="index.html#examples">Examples</a></li>
  60. <li><a href="index.html#themes">Themes</a></li>
  61. <li><a href="index.html#usage">How to use</a></li>
  62. <li><a href="faqs.html">FAQs</a></li>
  63. <li><a href="known_issues.html">Known issues</a></li>
  64. <li><a href="index.html#support">Support</a></li>
  65. <li><a href="index.html#download">Download</a></li>
  66. </ul>
  67. </div>
  68. <div id="container">
  69. <h1>jScrollPane - dynamic content demo page</h1>
  70. <p>
  71. This demonstration shows how you can manually reinitialise jScrollPane when new content is added to it.
  72. Every second we add a new line of content to the scrollpane (using the <a href="api.html#getContentPane">
  73. getContentPane</a> API method) and then <a href="api.html#reinitialise">reinitialise</a> the scrollpane.
  74. As the <a href="settings.html#maintainPosition">maintainPosition</a> setting is true by default then
  75. the position of the scrollpane is maintained even if we are scrolling while the update happens.
  76. </p>
  77. <div class="scroll-pane">
  78. </div>
  79. <h2>Page javascript</h2>
  80. <div id="sourcecode-display">
  81. <p>The contents of this div will be replaced by the javascript added to this page</p>
  82. </div>
  83. <h2>Page CSS</h2>
  84. <div id="css-display">
  85. <p>The contents of this div will be replaced by the CSS added to this page</p>
  86. </div>
  87. </div>
  88. </body>
  89. </html>