| OLD | NEW |
| (Empty) | |
| 1 <script> |
| 2 if (window.testRunner) |
| 3 testRunner.waitUntilDone(); |
| 4 |
| 5 function doTest() { |
| 6 finishTestInXFrames(2); |
| 7 } |
| 8 |
| 9 function finishTestInXFrames(frames) { |
| 10 if (frames > 0) { |
| 11 requestAnimationFrame(finishTestInXFrames.bind(null, frames - 1)); |
| 12 return; |
| 13 } |
| 14 finishTest(); |
| 15 } |
| 16 |
| 17 function finishTest() { |
| 18 for (const scroller of document.querySelectorAll('.scroller')) { |
| 19 scroller.scrollTop = 400; |
| 20 } |
| 21 if (window.testRunner) |
| 22 testRunner.notifyDone(); |
| 23 } |
| 24 |
| 25 window.addEventListener('load', doTest, false); |
| 26 </script> |
| 27 |
| 28 <style> |
| 29 body { |
| 30 margin: 0; |
| 31 } |
| 32 |
| 33 .scroller { |
| 34 will-change: transform; |
| 35 |
| 36 overflow: hidden; /* hide scrollbars */ |
| 37 width: 200px; |
| 38 height: 500px; |
| 39 outline: 2px solid black; |
| 40 } |
| 41 |
| 42 .container { |
| 43 width: 200px; |
| 44 height: 1000px; |
| 45 } |
| 46 |
| 47 .sticky { |
| 48 will-change: transform; |
| 49 |
| 50 position: sticky; |
| 51 width: 200px; |
| 52 top: 0; |
| 53 } |
| 54 |
| 55 .first { |
| 56 height: 500px; |
| 57 background: red; |
| 58 } |
| 59 |
| 60 .second { |
| 61 height: 400px; |
| 62 background: green; |
| 63 } |
| 64 |
| 65 .third { |
| 66 height: 300px; |
| 67 background: blue; |
| 68 top: 100px; |
| 69 } |
| 70 |
| 71 .fourth { |
| 72 height: 200px; |
| 73 background: pink; |
| 74 top: 100px; |
| 75 } |
| 76 |
| 77 .fifth { |
| 78 height: 100px; |
| 79 background: yellow; |
| 80 } |
| 81 </style> |
| 82 |
| 83 <div class="scroller"> |
| 84 <div class="container"> |
| 85 <div class="first sticky"> |
| 86 <div class="second sticky"> |
| 87 <div class="third sticky"> |
| 88 <div class="fourth sticky"> |
| 89 <div class="fifth sticky"></div> |
| 90 </div> |
| 91 </div> |
| 92 </div> |
| 93 </div> |
| 94 </div> |
| 95 </div> |
| OLD | NEW |