scroll-position.html (790B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="UTF-8"> 5 <title>Fragment Navigation: Scroll to block start position</title> 6 <script src="/resources/testharness.js"></script> 7 <script src="/resources/testharnessreport.js"></script> 8 </head> 9 <body> 10 <div id="test" style="position: absolute; top: 5px; left: 7px; margin: 5px 7px; border-style: solid; border-width: 5px 7px; padding: 5px 7px; height: 5px; width: 7px;"></div> 11 <div style="height: 200vh;"></div> 12 <script> 13 async_test(function (t) { 14 on_event(window, 'load', function () { 15 t.step(function () { 16 window.scrollTo(0, 0); 17 location.hash = 'test'; 18 assert_equals(window.scrollY, 10, 'Scroll to the top border edge of #test'); 19 }); 20 t.done(); 21 }); 22 }, ''); 23 </script> 24 </body> 25 </html>