var h = $(window).height();
$('#id1,#id2').css({
'background-color': '#b0c4de',
'height': h
});
var prevScroll = 0;
var up = true,
down = true;
$(window).scroll(function () {
var currScroll = $(this).scrollTop();
if (currScroll > prevScroll) {
if (down) {
down = false;
$("html, body").animate({
scrollTop: $(document).height()
}, 1000, function () {
down = true;
});
}
} else {
if (up) {
up = false;
$("html, body").animate({
scrollTop: 0
}, 1000, function () {
up = true;
});
}
}
prevScroll = currScroll;
e.preventDefault();
e.stopPropagation();
});