You can get the value of the current position #feed-inner relative to #feed using $. position . With this, you can check if the position is at 0 or the maximum height is 560 pixels. The code will look something like this:
$('#arrow-next').click(function() { $('#feed-inner').animate({ top: parseInt($('#feed-inner').position().top) == 0 ? '0' : '-=70' }, 500, function() { }); }); $('#arrow-prev').click(function() { $('#feed-inner').animate({ top: parseInt($('#feed-inner').position().top) == 560 ? '560' : '+=70' }, 500, function() { }); });
Note that #arrow-next will bring #feed-inner up (making it look like scrolling content down), which seems to contradict the βnextβ label and vice versa for #arrow-prev .
One more note: when the #feed-inner position reaches 560px , there will be an empty canvas, since the element has completely moved to the bottom, and what you see is an empty #feed container. To avoid this, you would like to calculate the height of the #feed container and make sure that #feed-inner does not move after 560 - $(#feed).outerHeight();
source share