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 height: 2000px; |
| 14 overflow: hidden; /* hide scrollbars */ |
| 15 } |
| 16 |
| 17 .group { |
| 18 position: relative; |
| 19 width: 250px; |
| 20 height: 450px; |
| 21 } |
| 22 |
| 23 .container { |
| 24 width: 200px; |
| 25 height: 600px; |
| 26 outline: 2px solid black; |
| 27 } |
| 28 |
| 29 .box { |
| 30 width: 200px; |
| 31 height: 200px; |
| 32 } |
| 33 |
| 34 .before { |
| 35 background-color: orange; |
| 36 height: 50px; |
| 37 } |
| 38 |
| 39 .after { |
| 40 background-color: blue; |
| 41 height: 50px; |
| 42 } |
| 43 .sticky { |
| 44 background-color: green; |
| 45 position: sticky; |
| 46 top: 300px; |
| 47 } |
| 48 </style> |
| 49 <script> |
| 50 function doTest() |
| 51 { |
| 52 window.scrollTo(0, 100); |
| 53 } |
| 54 window.addEventListener('load', doTest, false); |
| 55 </script> |
| 56 </head> |
| 57 <body> |
| 58 <div class="group" style="top: 100px"> |
| 59 <div class="container"> |
| 60 <div class="before box"></div> |
| 61 <div class="sticky box"></div> |
| 62 <div class="after box"></div> |
| 63 </div> |
| 64 </div> |
| 65 |
| 66 </body> |
| 67 </html> |
OLD | NEW |