| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE html> |
| 2 <title>position:sticky elements should respect the right constraint</title> |
| 3 <link rel="match" href="position-sticky-right-ref.html" /> |
| 4 <link rel="help" href="https://www.w3.org/TR/css-position-3/#sticky-pos" /> |
| 5 <meta name="assert" content="This test checks that position:sticky elements obey
their right anchor after scrolling" /> |
| 6 |
| 7 <style> |
| 8 .group { |
| 9 position: relative; |
| 10 width: 250px; |
| 11 height: 150px; |
| 12 } |
| 13 |
| 14 .scroller { |
| 15 position: relative; |
| 16 width: 200px; |
| 17 height: 100px; |
| 18 overflow-x: auto; |
| 19 overflow-y: hidden; |
| 20 } |
| 21 |
| 22 .contents { |
| 23 height: 100%; |
| 24 width: 500px; |
| 25 } |
| 26 |
| 27 .prepadding { |
| 28 display: inline-block; |
| 29 height: 100%; |
| 30 width: 200px; |
| 31 } |
| 32 |
| 33 .container { |
| 34 display: inline-block; |
| 35 height: 100%; |
| 36 width: 200px; |
| 37 } |
| 38 |
| 39 .filler { |
| 40 display: inline-block; |
| 41 height: 100%; |
| 42 width: 100px; |
| 43 } |
| 44 |
| 45 .indicator { |
| 46 background-color: red; |
| 47 position: absolute; |
| 48 top: 0; |
| 49 } |
| 50 |
| 51 .sticky { |
| 52 background-color: green; |
| 53 position: sticky; |
| 54 right: 25px; |
| 55 } |
| 56 |
| 57 .box { |
| 58 display: inline-block; |
| 59 height: 100%; |
| 60 width: 100px; |
| 61 } |
| 62 </style> |
| 63 |
| 64 <script> |
| 65 window.addEventListener('load', function() { |
| 66 document.getElementById('scroller1').scrollLeft = 100; |
| 67 document.getElementById('scroller2').scrollLeft = 175; |
| 68 document.getElementById('scroller3').scrollLeft = 250; |
| 69 }); |
| 70 </script> |
| 71 |
| 72 <div class="group"> |
| 73 <div id="scroller1" class="scroller"> |
| 74 <div class="indicator box" style="left: 200px;"></div> |
| 75 <div class="contents"> |
| 76 <!-- As these elements are inline, they are whitespace sensitive. --> |
| 77 <div class="prepadding"></div><div class="container"><div class="filler"><
/div><div class="sticky box"></div></div> |
| 78 </div> |
| 79 </div> |
| 80 </div> |
| 81 |
| 82 <div class="group"> |
| 83 <div id="scroller2" class="scroller"> |
| 84 <div class="indicator box" style="left: 250px;"></div> |
| 85 <div class="contents"> |
| 86 <!-- As these elements are inline, they are whitespace sensitive. --> |
| 87 <div class="prepadding"></div><div class="container"><div class="filler"><
/div><div class="sticky box"></div></div> |
| 88 </div> |
| 89 </div> |
| 90 </div> |
| 91 |
| 92 <div class="group"> |
| 93 <div id="scroller3" class="scroller"> |
| 94 <div class="indicator box" style="left: 300px;"></div> |
| 95 <div class="contents"> |
| 96 <!-- As these elements are inline, they are whitespace sensitive. --> |
| 97 <div class="prepadding"></div><div class="container"><div class="filler"><
/div><div class="sticky box"></div></div> |
| 98 </div> |
| 99 </div> |
| 100 </div> |
| 101 |
| 102 <div>You should see three green boxes above. No red should be visible.</div> |
| OLD | NEW |