Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <style> | |
| 3 body { | |
| 4 margin: 0px; | |
| 5 } | |
| 6 | |
| 7 .scroller { | |
| 8 overflow: scroll; | |
| 9 width: 200px; | |
| 10 height: 600px; | |
| 11 } | |
| 12 | |
| 13 .composited { | |
| 14 will-change: transform; | |
| 15 } | |
| 16 | |
| 17 .box { | |
| 18 background: rgba(0, 255, 0, 0.9); | |
| 19 position: sticky; | |
| 20 width: 100%; | |
|
flackr
2017/04/28 17:14:57
nit: Shouldn't this be the same width as the indic
yigu
2017/04/28 20:01:29
Done.
| |
| 21 height: 50px; | |
| 22 top: 0px; | |
| 23 } | |
| 24 | |
| 25 .indicator { | |
| 26 position: absolute; | |
| 27 width: 185px; | |
| 28 height: 50px; | |
| 29 top: 200px; | |
| 30 background: red; /* covered up by .box when working */ | |
| 31 } | |
| 32 | |
| 33 .container { | |
| 34 width: 100%; | |
| 35 height: 1000px; | |
| 36 background: grey; | |
| 37 } | |
| 38 </style> | |
| 39 | |
| 40 <div id="scroller" class="scroller"> | |
| 41 <div class="composited container"> | |
| 42 <div class="indicator"></div> | |
| 43 <div class="box"></div> | |
| 44 </div> | |
| 45 </div> | |
| 46 | |
| 47 <script> | |
| 48 if (window.testRunner) | |
| 49 testRunner.waitUntilDone() | |
| 50 | |
| 51 function doTest() { | |
| 52 let scroller = document.getElementById('scroller'); | |
| 53 window.requestAnimationFrame(function() { | |
| 54 scroller.scrollTop = 200; | |
| 55 if (window.testRunner) | |
| 56 testRunner.notifyDone(); | |
| 57 }); | |
| 58 } | |
| 59 | |
| 60 window.addEventListener('load', function() { | |
| 61 window.requestAnimationFrame(function() { | |
| 62 window.requestAnimationFrame(doTest); | |
| 63 }) | |
| 64 }); | |
| 65 </script> | |
| 66 | |
| OLD | NEW |