scroll.html 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html>
  4. <head>
  5. <meta http-equiv="Content-type" content="text/html; charset=utf-8">
  6. <title>scroll</title>
  7. <style type="text/css" media="screen">
  8. body { margin: 1px; padding: 5px; }
  9. div.scroll { position: relative; margin: 1px; border: 2px solid #000; padding: 5px; width: 100px; height: 100px; background: #fff; overflow: auto; }
  10. #scroll-1 { top: 0; left: 0; }
  11. #scroll-1-1 { top: 1px; left: 1px; }
  12. #scroll-1-1-1 { top: 1px; left: 1px; }
  13. #forceScroll { width: 5000px; height: 5000px; }
  14. #marker { position: absolute; border: 2px solid #000; width: 50px; height: 50px; background: #ccc; }
  15. </style>
  16. <script src="../../jquery.js"></script>
  17. <script type="text/javascript" charset="utf-8">
  18. jQuery(function($) {
  19. window.scrollTo(1000,1000);
  20. $('#scroll-1')[0].scrollLeft = 5;
  21. $('#scroll-1')[0].scrollTop = 5;
  22. $('.scroll').click(function() {
  23. $('#marker').css( $(this).offset() );
  24. return false;
  25. });
  26. });
  27. </script>
  28. </head>
  29. <body>
  30. <div id="scroll-1" class="scroll">
  31. <div id="scroll-1-1" class="scroll">
  32. <div id="scroll-1-1-1" class="scroll"></div>
  33. </div>
  34. </div>
  35. <div id="forceScroll"></div>
  36. <div id="marker"></div>
  37. <p class="instructions">Click the white box to move the marker to it.</p>
  38. </body>
  39. </html>