you could use the jQuery ScrollTo Plugin
here is a demo
here is a jsfiddle demo for what you want (using the scrollTo plugin)
jsfiddle demo
the javascript:
$('#upDownArrow').click(function() {
if($(this).hasClass("arrowUp")) {
$.scrollTo( '#top', 500); // scroll to top
$(this).removeClass("arrowUp");
$(this).addClass("arrowDown");
} else {
$.scrollTo( '#bottom', 500); // scroll to bottom
$(this).removeClass("arrowDown");
$(this).addClass("arrowUp");
}
});
the html:
<div id="#top"></div>
<div id="upDownArrow" class="arrowDown"><div class="arrow"></div></div>
<!-- add your content here -->
<div id="#bottom"></div>
the css:
#upDownArrow {
position: fixed;
top: 50px;
right: 50px;
width: 30px;
height: 30px;
background: #33B;
}
#upDownArrow:hover {
background: #99F;
cursor: pointer;
}
#upDownArrow.arrowDown:hover .arrow {
border-top-color: #99F;
}
#upDownArrow.arrowUp:hover .arrow {
border-bottom-color: #99F;
}
#upDownArrow.arrowUp .arrow {
position: absolute;
border: 15px solid transparent;
border-bottom: 15px solid #33B;
top: -30px;
}
#upDownArrow.arrowDown .arrow {
position: absolute;
border: 15px solid transparent;
border-top: 15px solid #33B;
bottom: -30px;
}
if you want a previous / next button, you might have to create a list of items / id's / positions (look at the documentation of the scrollTo plugin to see what parameters you can use) that should get stepped through like that:
var steps = ["top","part1","part2","bottom"];
and then create 2 buttons, one for up, one for down and then use:
var currentPosition = 0;
$("#buttonUp").click(function() {
if(currentPosition == 0) {
currentPosition = steps.length-1;
} else {
currentPosition--;
}
$.scrollTo('#'+steps[currentPosition],500);
});
$("#buttonDown").click(function() {
if(currentPosition == steps.length-1) {
currentPosition = 0;
} else {
currentPosition++;
}
$.scrollTo('#'+steps[currentPosition],500);
});
here is a demo with up and down button:
jsfiddle demo with up and down
jsfiddle demo up and down fullscreen
here another demo with your "button-changes" on scroll ;)
jsfiddle button changes demo