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