OLD | NEW |
(Empty) | |
| 1 <style> |
| 2 body { |
| 3 margin: 0; |
| 4 } |
| 5 |
| 6 .scroller { |
| 7 overflow: auto; |
| 8 width: 200px; |
| 9 height: 500px; |
| 10 outline: 2px solid black; |
| 11 } |
| 12 |
| 13 .container { |
| 14 width: 200px; |
| 15 height: 1000px; |
| 16 } |
| 17 |
| 18 .first { |
| 19 position: relative; |
| 20 top: 400px; |
| 21 height: 100px; |
| 22 width: 200px; |
| 23 background-color: green; |
| 24 } |
| 25 |
| 26 .second { |
| 27 position: relative; |
| 28 top: 400px; |
| 29 height: 100px; |
| 30 width: 200px; |
| 31 background-color: yellow; |
| 32 } |
| 33 |
| 34 .third { |
| 35 position: relative; |
| 36 top: 400px; |
| 37 height: 100px; |
| 38 width: 200px; |
| 39 background-color: pink; |
| 40 } |
| 41 |
| 42 .fourth { |
| 43 position: relative; |
| 44 top: 400px; |
| 45 height: 100px; |
| 46 width: 200px; |
| 47 background-color: blue; |
| 48 } |
| 49 |
| 50 .fifth { |
| 51 position: relative; |
| 52 top: 400px; |
| 53 height: 100px; |
| 54 width: 200px; |
| 55 background-color: red; |
| 56 } |
| 57 </style> |
| 58 |
| 59 <script> |
| 60 window.addEventListener('load', function() { |
| 61 document.querySelector('.scroller').scrollTop = 400; |
| 62 }); |
| 63 </script> |
| 64 |
| 65 <div class="scroller"> |
| 66 <div class="container"> |
| 67 <div class="first"></div> |
| 68 <div class="second"></div> |
| 69 <div class="third"></div> |
| 70 <div class="fourth"></div> |
| 71 <div class="fifth"></div> |
| 72 </div> |
| 73 </div> |
OLD | NEW |