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 </style> |
| 40 <script> |
| 41 function doTest() |
| 42 { |
| 43 window.scrollTo(300, 0); |
| 44 } |
| 45 window.addEventListener('load', doTest, false); |
| 46 </script> |
| 47 </head> |
| 48 <body> |
| 49 <div class="group" style="left: 200px"> |
| 50 <div class="container"> |
| 51 <div class="sticky box" style="margin: 0 auto;"></div> |
| 52 </div> |
| 53 </div> |
| 54 |
| 55 <div class="group" style="left: 200px"> |
| 56 <div class="container"> |
| 57 <div class="sticky box" style="margin: 0 20px;"></div> |
| 58 </div> |
| 59 </div> |
| 60 |
| 61 <div class="group" style="left: 200px"> |
| 62 <div class="container"> |
| 63 <div class="sticky box" style="margin: 0 20%;"></div> |
| 64 </div> |
| 65 </div> |
| 66 </body> |
| 67 </html> |
OLD | NEW |