I am trying to make this scrolleffect work on a website. When a users scroll down it automagically has to go to the next slide. When the users scrolls up it has to go one slide back. I have tried a lot of things using the onScroll
function in Jquery, but none of them seem to work.
I use the following script to check whether the users scrolls up or down.
var lastScrollTop = 0;
var check = 1;
var scrollDirection = 'down';
var scrollBottom = $(window).scrollTop() + $(window).height();
$(window).scroll(function(event) {
slideHeight = $('.slide').height();
var st = $(this).scrollTop();
if (st > lastScrollTop){
scrollDirection = 'down';
if (check == 1){
$('body').scrollTo( {top:'0px', left:'100%'}, 800 );
check = 0;
}
} else {
scrollDirection = 'up';
}
lastScrollTop = st;
console.log('ScrollDirection: '+ scrollDirection);
});
I am not coming any further than this. The (test)website where developing takes place is: http://bit.ly/RBcffY If anyone has experience with this kind of function it would be really helpful.