Created
September 17, 2015 17:07
-
-
Save Drnutsu/0173131ebedd9bf8cd76 to your computer and use it in GitHub Desktop.
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
$('#parent').bind('mousewheel', function (e) { | |
if (!(e.originalEvent.wheelDelta == 120)) { | |
var top = parseInt($("#child").css("top")); | |
$("#child").css("top", (top - 100) + "px"); | |
top = parseInt($("#child").css("top")); | |
if (top <= -500) { | |
setTimeout(function () { | |
$("#child").css("top", "-500px"); | |
}, 100); | |
} | |
} else { | |
var top = parseInt($("#child").css("top")); | |
$("#child").css("top", (top + 100) + "px"); | |
top = parseInt($("#child").css("top")); | |
if (top >= 0) { | |
setTimeout(function () { | |
$("#child").css("top", "0"); | |
}, 100); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment