| 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: 300px; |
| 8 height: 150px; |
| 9 } |
| 10 |
| 11 .scroller { |
| 12 position: relative; |
| 13 width: 250px; |
| 14 height: 100px; |
| 15 overflow-x: auto; |
| 16 overflow-y: hidden; |
| 17 } |
| 18 |
| 19 .contents { |
| 20 height: 100%; |
| 21 width: 1000px; |
| 22 } |
| 23 |
| 24 .box { |
| 25 height: 100%; |
| 26 width: 100px; |
| 27 } |
| 28 |
| 29 .indicator { |
| 30 background-color: green; |
| 31 position: absolute; |
| 32 top: 0; |
| 33 } |
| 34 </style> |
| 35 |
| 36 <script> |
| 37 window.addEventListener('load', function() { |
| 38 for (const scroller of document.querySelectorAll('.scroller')) { |
| 39 scroller.scrollLeft = 250; |
| 40 } |
| 41 }); |
| 42 </script> |
| 43 |
| 44 <div class="group"> |
| 45 <div class="scroller"> |
| 46 <div class="contents"> |
| 47 <div class="indicator box" style="left: 400px;"></div> |
| 48 </div> |
| 49 </div> |
| 50 </div> |
| 51 |
| 52 <div class="group"> |
| 53 <div class="scroller"> |
| 54 <div class="contents"> |
| 55 <div class="indicator box" style="left: 325px;"></div> |
| 56 </div> |
| 57 </div> |
| 58 </div> |
| 59 |
| 60 <div class="group"> |
| 61 <div class="scroller"> |
| 62 <div class="contents"> |
| 63 <div class="indicator box" style="left: 275px;"></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 |