| <script> | |
| onload = function() { | |
| scroller.scrollTop = 200; | |
| } | |
| </script> | |
| <style> | |
| .composited { | |
| /* Triggers promotion and creates a stacking context */ | |
| will-change: transform; | |
| } | |
| #scroller { | |
| overflow: scroll; | |
| height: 200px; | |
| width: 200px; | |
| } | |
| .container { | |
| height: 500px; | |
| background: red; | |
| } | |
| .sticky { | |
| position: sticky; | |
| top: 25px; | |
| height: 50px; | |
| background: green; | |
| } | |
| </style> | |
| <div id="scroller" class="composited"> | |
| <div class="composited container"> | |
| <div class="composited sticky"></div> | |
| </div> | |
| </div> |