| <!DOCTYPE html> |
| <script> |
| if (window.internals) { |
| internals.settings.setCSSStickyPositionEnabled(true); |
| } |
| </script> |
| <style> |
| body { |
| height: 2000px; |
| margin: 0; |
| overflow: hidden; |
| padding: 0; |
| } |
| .sticky { |
| width: 200px; |
| height: 200px; |
| background-color: green; |
| display: inline-block; |
| position: sticky; |
| top: 0; |
| } |
| .block { |
| width: 200px; |
| height: 200px; |
| background-color: red; |
| } |
| </style> |
| <script> |
| function doTest() |
| { |
| window.scrollTo(0, 200); |
| } |
| window.addEventListener('load', doTest, false); |
| </script> |
| <span class="sticky"></span> |
| <div class="block"></div> |
| |