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