I'm currently trying to move the wider div B horizontally inside the smaller <div> A using two buttons.
I found a similar problem using jquery, but I do not want to use the library only for this section in the code.
Here is the fiddle
I want to scroll the visible field of view using the left and right buttons to move the 100 pixels field in any direction without using jquery, but with pure Javascript, HTML and CSS.
<div id="outer-div" style="width:250px;overflow:hidden;"> <div style="width:750px;"> <div style="background-color:orange;width:250px;height:100px;float:left;"> </div> <div style="background-color:red;width:250px;height:100px;float:left;"> </div> <div style="background-color:blue;width:250px;height:100px;float:left;"> </div> </div> </div> <button>left</button> <button>right</button>
source share