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