scroll-behavior-1.html 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <!DOCTYPE HTML>
  2. <html class="reftest-wait">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Testcase for bug 1010538, smooth scrolling expected</title>
  6. <style type="text/css">
  7. html,body {
  8. color: black;
  9. background-color: white;
  10. font-size: 16px;
  11. padding: 0;
  12. margin: 0;
  13. }
  14. body {
  15. scroll-behavior: smooth;
  16. }
  17. #a_box {
  18. position: relative;
  19. left: 10px;
  20. top: 10px;
  21. width: 20px;
  22. height: 20px;
  23. background: blue;
  24. }
  25. #another_box {
  26. position: relative;
  27. left: 2000px;
  28. top: 2000px;
  29. width: 20px;
  30. height: 20px;
  31. background: green;
  32. }
  33. </style>
  34. </head>
  35. <body>
  36. <div id="a_box"></div>
  37. <div id="another_box"></div>
  38. <script>
  39. function doTest() {
  40. if (document.location.search != '?ref') {
  41. window.scrollTo({left: 500, top: 500});
  42. window.scrollTo({left: window.scrollX, top: window.scrollY});
  43. }
  44. document.documentElement.removeAttribute("class");
  45. }
  46. window.scrollTo({left: 0, top: 0, behavior: "instant"});
  47. window.addEventListener("MozReftestInvalidate", doTest, false);
  48. </script>
  49. </body>
  50. </html>