Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <title>Sticky positioned element should behave correctly when style changes</tit le> | |
| 3 <link rel="match" href="position-sticky-style-change-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 sticky positioned element beh aves correctly when style changes." /> | |
| 6 | |
| 7 <style> | |
| 8 html { | |
| 9 overflow: hidden; /* hide scrollbars */ | |
| 10 } | |
| 11 | |
| 12 body { | |
| 13 margin: 0; | |
| 14 } | |
| 15 | |
| 16 .container { | |
| 17 width: 200px; | |
| 18 height: 200px; | |
| 19 } | |
| 20 | |
| 21 .spacer { | |
| 22 height: 2000px; | |
| 23 } | |
| 24 | |
| 25 .box { | |
| 26 width: 100px; | |
| 27 height: 100px; | |
| 28 background-color: green; | |
| 29 top: 50px; | |
| 30 } | |
| 31 | |
| 32 .sticky { | |
| 33 position: sticky; | |
| 34 } | |
| 35 | |
| 36 .relative { | |
| 37 position: relative; | |
| 38 } | |
| 39 </style> | |
| 40 | |
| 41 <script> | |
| 42 window.addEventListener('load', function() { | |
| 43 document.getElementById('scroller1').scrollTop = 100; | |
| 44 document.getElementById('scroller2').scrollTop = 100; | |
| 45 | |
| 46 var sticky1 = document.getElementById('sticky1'); | |
| 47 sticky1.style.position = 'relative'; | |
|
flackr
2017/05/31 14:13:47
I thought the thing we wanted to test was that que
yigu
2017/05/31 20:06:24
Done.
| |
| 48 | |
| 49 var sticky2 = document.getElementById('sticky2'); | |
| 50 sticky2.style.position = 'sticky'; | |
| 51 }); | |
| 52 </script> | |
| 53 | |
| 54 <div id="scroller1" class="container"> | |
| 55 <div id="sticky1" class="sticky box"></div> | |
| 56 <div class="spacer"></div> | |
| 57 </div> | |
| 58 <div id="scroller2" class="container"> | |
| 59 <div id="sticky2" class="relative box"></div> | |
| 60 <div class="spacer"></div> | |
| 61 </div> | |
| OLD | NEW |