OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <script> |
| 3 if (window.internals) { |
| 4 internals.settings.setCSSStickyPositionEnabled(true); |
| 5 } |
| 6 </script> |
| 7 |
| 8 <html> |
| 9 <head> |
| 10 <style> |
| 11 .group { |
| 12 display: inline-block; |
| 13 position: relative; |
| 14 width: 150px; |
| 15 height: 500px; |
| 16 } |
| 17 |
| 18 #overflow { |
| 19 width: 600px; |
| 20 height: 400px; |
| 21 overflow: hidden; /* Still scrollable with JS */ |
| 22 padding: 20px; |
| 23 border: 1px solid black; |
| 24 } |
| 25 |
| 26 .spacer { |
| 27 float: left; |
| 28 width: 10px; |
| 29 height: 1200px; |
| 30 } |
| 31 .container { |
| 32 width: 100px; |
| 33 height: 300px; |
| 34 outline: 2px solid black; |
| 35 } |
| 36 |
| 37 .box { |
| 38 width: 100px; |
| 39 height: 150px; |
| 40 } |
| 41 |
| 42 .sticky { |
| 43 position: sticky; |
| 44 bottom: 0px; |
| 45 background-color: green; |
| 46 } |
| 47 |
| 48 .indicator { |
| 49 position: absolute; |
| 50 top: 0; |
| 51 left: 0; |
| 52 background-color: red; |
| 53 } |
| 54 </style> |
| 55 <script> |
| 56 function doTest() |
| 57 { |
| 58 document.getElementById('overflow').scrollTop = 100; |
| 59 } |
| 60 window.addEventListener('load', doTest, false); |
| 61 </script> |
| 62 </head> |
| 63 <body> |
| 64 <div id="overflow"> |
| 65 <div class="spacer"></div> |
| 66 <div class="group" style="top: 350px"> |
| 67 <div class="indicator box" style="top: 0px;"></div> |
| 68 <div class="container"> |
| 69 <div class="box"></div> |
| 70 <div class="sticky box"></div> |
| 71 </div> |
| 72 </div> |
| 73 |
| 74 <div class="group" style="top: 250px"> |
| 75 <div class="indicator box" style="top: 100px;"></div> |
| 76 <div class="container"> |
| 77 <div class="box"></div> |
| 78 <div class="sticky box"></div> |
| 79 </div> |
| 80 </div> |
| 81 |
| 82 <div class="group" style="top: 200px"> |
| 83 <div class="indicator box" style="top: 150px;"></div> |
| 84 <div class="container"> |
| 85 <div class="box"></div> |
| 86 <div class="sticky box"></div> |
| 87 </div> |
| 88 </div> |
| 89 </div> |
| 90 <div style="position: absolute; top: 500px;"> |
| 91 This test checks that sticky positioned blocks positioned correctly in overf
low with padding. |
| 92 There should be no red. |
| 93 </div> |
| 94 </body> |
| 95 </html> |
OLD | NEW |