I need go go to the next or previous image using the side navigation (up/down arrows) I have created. The images are vertically stacked. How do I go about doing this? Code pen demo at the bottom.
HTML:
<div class="container">
<div class="col-md-12">
<h1 class="text-center">Title goes here</h1>
<img width="100%" class="img-responsive" src="https://placeimg.com/1000/500/arch" alt="" />
<img width="100%" class="img-responsive" src="https://placeimg.com/1000/500/arch" alt="" />
<img width="100%" class="img-responsive" src="https://placeimg.com/1000/500/arch" alt="" />
<img width="100%" class="img-responsive" src="https://placeimg.com/1000/500/arch" alt="" />
<div class="project-side-bar">
<a href="#" class="up-arrow"><i class="fa fa-arrow-up"></i></a>
<a href="#" class="down-arrow"><i class="fa fa-arrow-down"></i></a>
<div class="info"><a href="#info">info</a></div>
</div>
<div id="info">
<h2>Info down here</h2>
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>
</div>
</div>
</div>
JS: - I believe I start off like this?
$('img').each(function(i, el) {
imageArray.push(this.offsetTop);
});