JSFiddle - React, Tailwind, and code Playground
by Gabriele Petrioli
HTML
<div class="arrow up_arrow">UP</div>
<div class="content">
<img src="http://lorempixel.com/400/300/cats/1" />
<img src="http://lorempixel.com/400/300/cats/2" />
<img src="http://lorempixel.com/400/300/cats/3" />
</div>
<div class="arrow down_arrow">DOWN</div>
CSS
.content{
width:400px;
height:300px;
overflow:hidden;
border:1px solid #999;
}
.content img{display:block;}
.arrow{
display:inline-block;
padding:5px 15px;
background:#eee;
border-radius:3px;
margin:3px 0;
cursor:pointer;
border:1px solid #ddd;
}
JavaScript
var gallery = $('.content'),
height = gallery.height();
$('.arrow').on('click', function(){
var up = $(this).is('.up_arrow');
if (up) {
gallery.animate({'scrollTop': '-=' + height});
} else {
gallery.animate({'scrollTop': '+=' + height});
}
});