| 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 .container { | |
| 13 position: absolute; | |
| 14 width: 2000px; | |
| 15 height: 180px; | |
| 16 top: 350px; | |
| 17 outline: 2px solid black; | |
| 18 } | |
| 19 | |
| 20 .vertical.container { | |
| 21 top: 0px; | |
| 22 left: 350px; | |
| 23 width: 180px; | |
| 24 height: 2000px; | |
| 25 } | |
| 26 | |
| 27 .box { | |
| 28 width: 800px; | |
| 29 height: 180px; | |
| 30 } | |
| 31 | |
| 32 .vertical .box { | |
| 33 width: 180px; | |
| 34 height: 500px; | |
| 35 } | |
| 36 | |
| 37 .sticky { | |
| 38 position: sticky; | |
| 39 left: 50px; | |
| 40 right: 50px; | |
| 41 background-color: green; | |
| 42 } | |
| 43 | |
| 44 .vertical .sticky { | |
| 45 left: 0; | |
| 46 top: 50px; | |
| 47 bottom: 50px; | |
| 48 background-color: blue; | |
| 49 opacity: 0.75; | |
| 50 } | |
| 51 </style> | |
| 52 <script> | |
| 53 function doTest() | |
| 54 { | |
| 55 window.scrollTo(300, 300); | |
| 56 } | |
| 57 window.addEventListener('load', doTest, false); | |
| 58 </script> | |
| 59 </head> | |
| 60 <body> | |
| 61 <div class="container"> | |
| 62 <div class="sticky box"></div> | |
| 63 </div> | |
| 64 <div class="vertical container"> | |
| 65 <div class="sticky box"></div> | |
| 66 </div> | |
| 67 | |
| 68 </body> | |
| 69 </html> | |
| OLD | NEW |