| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE html> |
| 2 <title>Reference for position:sticky elements should respect the top constraint<
/title> |
| 3 |
| 4 <style> |
| 5 .group { |
| 6 display: inline-block; |
| 7 position: relative; |
| 8 width: 150px; |
| 9 height: 250px; |
| 10 } |
| 11 |
| 12 .scroller { |
| 13 position: relative; |
| 14 width: 100px; |
| 15 height: 200px; |
| 16 overflow-x: hidden; |
| 17 overflow-y: auto; |
| 18 } |
| 19 |
| 20 .contents { |
| 21 height: 500px; |
| 22 } |
| 23 |
| 24 .indicator { |
| 25 background-color: green; |
| 26 position: absolute; |
| 27 left: 0; |
| 28 } |
| 29 |
| 30 .box { |
| 31 width: 100%; |
| 32 height: 100px; |
| 33 } |
| 34 |
| 35 </style> |
| 36 |
| 37 <script> |
| 38 window.addEventListener('load', function() { |
| 39 document.getElementById('scroller1').scrollTop = 100; |
| 40 document.getElementById('scroller2').scrollTop = 175; |
| 41 document.getElementById('scroller3').scrollTop = 250; |
| 42 }); |
| 43 </script> |
| 44 |
| 45 <div class="group"> |
| 46 <div id="scroller1" class="scroller"> |
| 47 <div class="contents"> |
| 48 <div class="indicator box" style="top: 200px;"></div> |
| 49 </div> |
| 50 </div> |
| 51 </div> |
| 52 |
| 53 <div class="group"> |
| 54 <div id="scroller2" class="scroller"> |
| 55 <div class="contents"> |
| 56 <div class="indicator box" style="top: 250px;"></div> |
| 57 </div> |
| 58 </div> |
| 59 </div> |
| 60 |
| 61 <div class="group"> |
| 62 <div id="scroller3" class="scroller"> |
| 63 <div class="contents"> |
| 64 <div class="indicator box" style="top: 300px;"></div> |
| 65 </div> |
| 66 </div> |
| 67 </div> |
| 68 |
| 69 <div>You should see three green boxes above. No red should be visible.</div> |
| OLD | NEW |