Created
November 23, 2016 11:39
-
-
Save kirandash/0b6ed5980cfc61cf5d513e2828227c6d to your computer and use it in GitHub Desktop.
detect scroll up or down jquery for fixed height
This file contains hidden or 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
| /* SCROLL */ | |
| //Firefox | |
| $(window).bind('DOMMouseScroll', function(e){ | |
| if(e.originalEvent.detail > 0) { | |
| //scroll down | |
| zoomOutTimeline.to(screenToTilt, 10, {scale: 0}); | |
| }else { | |
| //scroll up | |
| zoomOutTimeline.to(screenToTilt, 10, {scale: 0}); | |
| } | |
| //prevent page fom scrolling | |
| return false; | |
| }); | |
| //IE, Opera, Safari | |
| $(window).bind('mousewheel', function(e){ | |
| if(e.originalEvent.wheelDelta < 0) { | |
| //scroll down | |
| zoomOutTimeline.to(screenToTilt, 10, {scale: 0}); | |
| }else { | |
| //scroll up | |
| zoomOutTimeline.to(screenToTilt, 10, {scale: 0}); | |
| } | |
| //prevent page fom scrolling | |
| return false; | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment