Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <style> | |
| 3 .scroller { | |
| 4 overflow: scroll; | |
| 5 width: 200px; | |
| 6 height: 600px; | |
| 7 } | |
| 8 | |
| 9 .box { | |
| 10 background: rgba(255, 0, 0, 0.5); | |
| 11 position: sticky; | |
|
flackr
2017/04/27 14:22:56
Just to avoid testing sticky with sticky, let's us
yigu
2017/04/27 15:20:10
Done.
| |
| 12 width: 100%; | |
| 13 height: 50px; | |
| 14 top: 0px; | |
| 15 } | |
| 16 | |
| 17 .container { | |
| 18 width: 100%; | |
| 19 height: 1000px; | |
| 20 background: green; | |
| 21 } | |
| 22 </style> | |
| 23 | |
| 24 <div id="scroller" class="scroller"> | |
| 25 <div class="container"> | |
| 26 <div class="box"></div> | |
| 27 </div> | |
| 28 </div> | |
| 29 | |
| 30 <script> | |
| 31 let scroller = document.getElementById('scroller'); | |
| 32 scroller.scrollTop = 200; | |
| 33 </script> | |
| OLD | NEW |