OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <script> |
| 3 if (window.internals) { |
| 4 internals.settings.setCSSStickyPositionEnabled(true); |
| 5 } |
| 6 </script> |
| 7 |
| 8 <style> |
| 9 body { |
| 10 margin: 0; |
| 11 height: 2000px; |
| 12 overflow: hidden; /* hide scrollbars */ |
| 13 } |
| 14 |
| 15 #container { |
| 16 background-color: green; |
| 17 width: 200px; |
| 18 height: 400px; |
| 19 outline: 2px solid black; |
| 20 } |
| 21 |
| 22 .box { |
| 23 width: 200px; |
| 24 height: 200px; |
| 25 } |
| 26 |
| 27 .sticky { |
| 28 position: sticky; |
| 29 top: 0px; |
| 30 background-color: red; |
| 31 } |
| 32 |
| 33 </style> |
| 34 <script> |
| 35 function doTest() |
| 36 { |
| 37 window.scrollTo(0, 200); |
| 38 // When the spacer's height is changed the sticky container moves up which s
hould now |
| 39 // require sliding the sticky box down. |
| 40 document.getElementById('container').style.overflow = 'hidden'; |
| 41 } |
| 42 window.addEventListener('load', doTest, false); |
| 43 </script> |
| 44 <div id="container"> |
| 45 <div class="sticky box"></div> |
| 46 </div> |
OLD | NEW |