OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 |
| 3 <html> |
| 4 <head> |
| 5 <style> |
| 6 body { |
| 7 margin: 0; |
| 8 height: 2000px; |
| 9 overflow: hidden; /* hide scrollbars */ |
| 10 } |
| 11 |
| 12 .group { |
| 13 display: inline-block; |
| 14 position: relative; |
| 15 width: 250px; |
| 16 height: 500px; |
| 17 } |
| 18 |
| 19 .container { |
| 20 width: 200px; |
| 21 height: 400px; |
| 22 outline: 2px solid black; |
| 23 } |
| 24 |
| 25 .box { |
| 26 width: 200px; |
| 27 height: 200px; |
| 28 } |
| 29 |
| 30 .sticky { |
| 31 position: sticky; |
| 32 top: 100px; |
| 33 bottom: 500px; |
| 34 background-color: green; |
| 35 } |
| 36 |
| 37 .indicator { |
| 38 position: absolute; |
| 39 top: 0; |
| 40 left: 0; |
| 41 background-color: red; |
| 42 } |
| 43 </style> |
| 44 <script> |
| 45 function doTest() |
| 46 { |
| 47 window.scrollTo(0, 100); |
| 48 } |
| 49 window.addEventListener('load', doTest, false); |
| 50 </script> |
| 51 </head> |
| 52 <body> |
| 53 <div class="group"> |
| 54 <div class="indicator box" style="top: 200px;"></div> |
| 55 <div class="container"> |
| 56 <div class="sticky box"></div> |
| 57 </div> |
| 58 </div> |
| 59 |
| 60 <div class="group" style="top: 100px"> |
| 61 <div class="indicator box" style="top: 100px;"></div> |
| 62 <div class="container"> |
| 63 <div class="sticky box"></div> |
| 64 </div> |
| 65 </div> |
| 66 |
| 67 <div class="group" style="top: 200px"> |
| 68 <div class="indicator box" style="top: 0;"></div> |
| 69 <div class="container"> |
| 70 <div class="sticky box"></div> |
| 71 </div> |
| 72 </div> |
| 73 <div style="position: absolute; top: 620px;"> |
| 74 This test checks that sticky positioned table theads are contained by th
eir table. |
| 75 There should be no red. |
| 76 </div> |
| 77 </body> |
| 78 </html> |
OLD | NEW |