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