Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <style> | |
| 3 body { | |
| 4 margin: 0; | |
| 5 } | |
| 6 | |
| 7 table { | |
| 8 background: red; | |
| 9 } | |
| 10 | |
| 11 td, th { | |
| 12 height: 50px; | |
| 13 width: 50px; | |
| 14 padding: 0; | |
| 15 } | |
| 16 | |
| 17 th { | |
| 18 background: green; | |
| 19 position: sticky; | |
| 20 top: 0px; | |
| 21 } | |
| 22 | |
| 23 .scroller { | |
| 24 width: 100px; | |
| 25 height: 200px; | |
| 26 } | |
| 27 </style> | |
| 28 | |
| 29 <script> | |
| 30 function doTest() { | |
| 31 for (let scroller of document.querySelectorAll('.scroller')) { | |
| 32 scroller.scrollTop = 200; | |
| 33 } | |
| 34 } | |
| 35 | |
| 36 window.addEventListener('load', function() { | |
| 37 window.requestAnimationFrame(function() { | |
|
flackr
2017/04/26 15:21:00
There's no need to delay the scroll for the expect
yigu
2017/04/26 21:46:57
Done.
| |
| 38 window.requestAnimationFrame(doTest); | |
| 39 }) | |
| 40 }); | |
| 41 </script> | |
| 42 | |
| 43 <div class="scroller"> | |
| 44 <table> | |
| 45 <thead> | |
| 46 <tr><th></th></tr> | |
| 47 </thead> | |
| 48 <tbody> | |
| 49 <tr><td></td></tr> | |
| 50 <tr><td></td></tr> | |
| 51 <tr><td></td></tr> | |
| 52 <tr><td></td></tr> | |
| 53 </tbody> | |
| 54 </table> | |
| 55 </div> | |
| OLD | NEW |