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