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