I can't find a post on here that is not jQuery based I need a plain JavaScript example and please don't suggest anything CSS solution related. I am aware that there is CSS methods to do things similar to this but for personal reasons I need a JavaScript solution for this instead.
Ok I need to make all the .x class names div's to be in reverse order so it will look like this
D
C
B
A
At default it looks like this
A
B
C
D
and I want the scroll box of the scroll bar on page load to start at the bottom with the reverse order of the .x div's like this photo shop image I created.
Here is my code currently
/*???*/
#a{
background-color: gold;
height: 500px;
width: 500px;
border-radius: 8px;
position: relative;
color: red;
}
#b{
background-color: orange;
height: 90%;
width: 90%;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
margin: auto;
overflow-y: auto;
overflow-x: hidden;
}
.x{
background-color: blue;
display: block;
height: 200px;
width: 100%;
position: relative;
border: 2px solid white;
}
<div id='a'>
<div id='b'>
<div class='x'>
<h1>A</h1>
</div><!--</x>-->
<div class='x'>
<h1>B</h1>
</div><!--</x>-->
<div class='x'>
<h1>C</h1>
</div><!--</x>-->
<div class='x'>
<h1>D</h1>
</div><!--</x>-->
</div><!--</b>-->
</div><!--</a>-->