I have lined up a series of 3 divs floating to the left in a straight line, each spanning the width of the page. Here is an example of the HTML structure:
<div class="Horizontal-Wrapper">
<div class="Horizontal-Section">
<div class="Project-Wrapper">
<div class="Project-Box" id="PJB1"><div class="Project-Box-Overlay"><h2>Splash</h2><p>Industries define the ideal selection for both wholesale and retail quantities of high quality</p></div></div>
<div class="Project-Box" id="PJB2"><div class="Project-Box-Overlay"><h2>Splash</h2><p>Industries define the ideal selection for both wholesale and retail quantities of high quality</p></div></div>
</div>
</div>
<div class="Horizontal-Section">
<div class="Project-Wrapper">
<div class="Project-Box" id="PJB3"><div class="Project-Box-Overlay"><h2>Splash</h2><p>Industries define the ideal selection for both wholesale and retail quantities of high quality</p></div></div>
<div class="Project-Box" id="PJB4"><div class="Project-Box-Overlay"><h2>Splash</h2><p>Industries define the ideal selection for both wholesale and retail quantities of high quality</p></div></div>
</div>
</div>
<div class="Horizontal-Section">
<div class="Project-Wrapper">
<div class="Project-Box" id="PJB5"><div class="Project-Box-Overlay"><h2>Splash</h2><p>Industries define the ideal selection for both wholesale and retail quantities of high quality</p></div></div>
<div class="Project-Box" id="PJB6"><div class="Project-Box-Overlay"><h2>Splash</h2><p>Industries define the ideal selection for both wholesale and retail quantities of high quality</p></div></div>
</div>
</div>
</div>
When a button is clicked, it should move to the next div. I achieved this using the following script;
var inner_width = $('body').innerWidth();
$('#next').on('click', function () {
$('.Horizontal-Section').animate({'left': 'inner_width' +'px'});
});
The issue I am encountering is that the scrolling behavior gets disoriented when resizing the browser, as I cannot obtain the correct page width.