So, I would like to have 2 buttons Next and Previous, which has to slide up or down in a text. Right now I got it to slide up and down 80px which is nice.
But I would like to know if it’s possible to make it slide to the next p tag? And how would you do that?
My code is this right now:
$('#next').click(function(){
$('#contentText').animate({
'top':'-=80px'
});
});
//
$('#previous').click(function(){
$('#contentText').animate({
'top':'+=80px'
});
});
//
You need the jQuery scrollTo plugin.
http://plugins.jquery.com/project/ScrollTo
Demo: http://demos.flesler.com/jquery/scrollTo/