| <!DOCTYPE html> |
| |
| <html> |
| <head> |
| <style> |
| body { |
| margin: 0; |
| height: 2000px; |
| overflow: hidden; /* hide scrollbars */ |
| } |
| |
| .container { |
| position: absolute; |
| width: 200px; |
| height: 400px; |
| margin: 10px; |
| left: 300px; |
| top: -200px; |
| font-family: Ahem; |
| font-size: 24px; |
| outline: 2px solid black; |
| } |
| |
| .vertical.container { |
| -webkit-writing-mode: vertical-rl; |
| top: 300px; |
| left: 800px; |
| width: 400px; |
| height: 200px; |
| } |
| |
| .spacer { |
| height: 350px; |
| width: 20px; |
| background-color: black; |
| } |
| |
| .vertical .spacer { |
| height: 20px; |
| width: 350px; |
| } |
| |
| .box { |
| width: 150px; |
| height: 150px; |
| } |
| |
| .sticky { |
| position: sticky; |
| top: 200px; |
| right: 200px; |
| background-color: green; |
| opacity: 0.75; |
| } |
| </style> |
| <script> |
| function doTest() |
| { |
| window.scrollTo(100, 100); |
| } |
| window.addEventListener('load', doTest, false); |
| </script> |
| </head> |
| <body> |
| <div class="container"> |
| <div class="spacer"></div> |
| <div class="sticky box"></div> |
| </div> |
| |
| <div class="vertical container"> |
| <div class="spacer"></div> |
| <div class="sticky box"></div> |
| </div> |
| </body> |
| </html> |