Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var lastScrollTop = 0;
- $(window).scroll(function(event){
- var st = $(this).scrollTop();
- var slide = 1
- if (st > lastScrollTop){
- if(checkBounds(slide)) {
- slide++;
- $('html, body').animate({
- scrollTop: $(".slide-" + slide).offset().top
- }, 1200);
- } else {
- slide = slide;
- }
- } else {
- if (checkBounds(slide)) {
- slide--;
- $('html, body').animate({
- scrollTop: $(".slide-" + slide).offset().top
- }, 1200);
- } else {
- slide = slide;
- }
- }
- lastScrollTop = st;
- });
- function checkBounds(slide) {
- return slide < 3 && slide >= 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement