Created
September 20, 2013 13:45
-
-
Save vitaliykononov/6637773 to your computer and use it in GitHub Desktop.
Apple Iphone like slider effect with the JQuery Mousewheel Plugin and scrollTo
http://www.apple.com/iphone-5s/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var isScrolling = false; | |
$('.container').mousewheel(function (event, delta) { | |
if (!isScrolling) { | |
isScrolling = true; | |
if (delta < 0) { | |
if ($next = $('#navbox').find('.active').next('li').children('a').attr('href')) { | |
$('.container').scrollTo($next, { | |
offset: 0, | |
duration: 1000, | |
onAfter: function () { | |
isScrolling = false; | |
} | |
}); | |
} else | |
isScrolling = false; | |
} | |
else if (delta > 0) { | |
if ($prev = $('#navbox').find('.active').prev('li').children('a').attr('href')) { | |
$('.container').scrollTo($prev, { | |
offset: 0, | |
duration: 1000, | |
onAfter: function () { | |
isScrolling = false; | |
} | |
}); | |
} else | |
isScrolling = false; | |
} | |
} | |
return false; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment