| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE html> |
| 2 <title>Sticky positioned element should behave correctly when style changes |
| 3 </title> |
| 4 |
| 5 <style> |
| 6 html { |
| 7 overflow: hidden; /* hide scrollbars */ |
| 8 } |
| 9 |
| 10 body { |
| 11 margin: 0; |
| 12 } |
| 13 |
| 14 .container { |
| 15 width: 200px; |
| 16 height: 200px; |
| 17 } |
| 18 |
| 19 .spacer { |
| 20 height: 2000px; |
| 21 } |
| 22 |
| 23 .box { |
| 24 width: 100px; |
| 25 height: 100px; |
| 26 background-color: green; |
| 27 } |
| 28 |
| 29 .relative { |
| 30 top: 50px; |
| 31 position: relative; |
| 32 } |
| 33 |
| 34 .absolute { |
| 35 top: 200px; |
| 36 position: absolute; |
| 37 } |
| 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 </script> |
| 47 |
| 48 <div id="scroller1" class="container"> |
| 49 <div class="relative box"></div> |
| 50 <div class="spacer"></div> |
| 51 </div> |
| 52 <div id="scroller2" class="container"> |
| 53 <div class="absolute box"></div> |
| 54 <div class="spacer"></div> |
| 55 </div> |
| 56 |
| OLD | NEW |