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