| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE html> |
| 2 |
| 3 <html> |
| 4 <head> |
| 5 <style> |
| 6 body { |
| 7 margin: 0; |
| 8 width: 5000px; |
| 9 overflow: hidden; /* hide scrollbars */ |
| 10 } |
| 11 |
| 12 .container { |
| 13 position: absolute; |
| 14 width: 5000px; |
| 15 height: 180px; |
| 16 top: 100px; |
| 17 outline: 2px solid black; |
| 18 } |
| 19 |
| 20 .vertical.container { |
| 21 top: 0px; |
| 22 left: 100px; |
| 23 width: 180px; |
| 24 height: 5000px; |
| 25 } |
| 26 |
| 27 .box { |
| 28 width: 300px; |
| 29 height: 180px; |
| 30 } |
| 31 |
| 32 .vertical .box { |
| 33 width: 180px; |
| 34 height: 300px; |
| 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 background-color: blue; |
| 48 opacity: 0.75; |
| 49 } |
| 50 .space { |
| 51 width:2000px; |
| 52 height:100%; |
| 53 background-color: grey; |
| 54 opacity: 0.1; |
| 55 } |
| 56 .vertical .space { |
| 57 height:2000px; |
| 58 background-color: grey; |
| 59 opacity: 0.1; |
| 60 } |
| 61 .inline { |
| 62 display: inline-block; |
| 63 } |
| 64 </style> |
| 65 <script> |
| 66 function doTest() |
| 67 { |
| 68 window.scrollTo(0, 3000); |
| 69 } |
| 70 window.addEventListener('load', doTest, false); |
| 71 </script> |
| 72 </head> |
| 73 <body> |
| 74 <div class="container"> |
| 75 <div class="space inline"></div> |
| 76 <div class="sticky box inline"></div> |
| 77 </div> |
| 78 <div class="vertical container"> |
| 79 <div class="vertical space"></div> |
| 80 <div class="sticky box"></div> |
| 81 </div> |
| 82 |
| 83 </body> |
| 84 </html> |
| 85 |
| OLD | NEW |