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