Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <title>position:sticky elements should respect the top constraint</title> | |
| 3 <link rel="match" href="position-sticky-top-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 top anchor after scrolling" /> | |
| 6 | |
| 7 <style> | |
| 8 .group { | |
| 9 display: inline-block; | |
| 10 position: relative; | |
| 11 width: 150px; | |
| 12 height: 300px; | |
| 13 } | |
| 14 | |
| 15 .scroller { | |
| 16 position: relative; | |
| 17 width: 100px; | |
| 18 height: 250px; | |
| 19 overflow-x: hidden; | |
| 20 overflow-y: auto; | |
| 21 } | |
| 22 | |
| 23 .contents { | |
| 24 height: 1000px; | |
| 25 } | |
| 26 | |
| 27 .padding { | |
| 28 height: 200px; | |
| 29 } | |
| 30 | |
| 31 .box { | |
| 32 width: 100%; | |
| 33 height: 100px; | |
| 34 } | |
| 35 | |
| 36 .indicator { | |
| 37 background-color: red; | |
| 38 position: absolute; | |
| 39 left: 0; | |
| 40 } | |
| 41 | |
| 42 .sticky { | |
| 43 background-color: green; | |
| 44 position: sticky; | |
| 45 } | |
| 46 </style> | |
| 47 | |
| 48 <script> | |
| 49 window.addEventListener('load', function() { | |
| 50 for (const scroller of document.querySelectorAll('.scroller')) { | |
| 51 scroller.scrollTop = 250; | |
| 52 } | |
| 53 }); | |
| 54 </script> | |
| 55 | |
| 56 <div class="group"> | |
| 57 <div class="scroller"> | |
| 58 <div class="indicator box" style="top: 250px;"></div> | |
| 59 <div class="contents"> | |
| 60 <div class="padding"></div> | |
| 61 <div class="sticky box" style="top: 0;"></div> | |
| 62 </div> | |
| 63 </div> | |
| 64 </div> | |
| 65 | |
| 66 <div class="group"> | |
| 67 <div class="scroller"> | |
| 68 <div class="indicator box" style="top: 325px;"></div> | |
| 69 <div class="contents"> | |
| 70 <div class="padding"></div> | |
| 71 <div class="sticky box" style="top: 75px;"></div> | |
| 72 </div> | |
| 73 </div> | |
| 74 </div> | |
| 75 | |
| 76 <div class="group"> | |
| 77 <div class="scroller"> | |
| 78 <div class="indicator box" style="top: 375px;"></div> | |
| 79 <div class="contents"> | |
| 80 <div class="padding"></div> | |
| 81 <div class="sticky box" style="top: 125px;"></div> | |
|
flackr
2017/04/07 18:46:51
To test the three conditions (before sticking, dur
smcgruer
2017/04/19 19:11:16
Done. All tests now test each condition which is m
| |
| 82 </div> | |
| 83 </div> | |
| 84 </div> | |
| 85 | |
| 86 <div>You should see three green boxes above. No red should be visible.</div> | |
| OLD | NEW |