Last active
December 29, 2015 09:28
-
-
Save nola/7650145 to your computer and use it in GitHub Desktop.
example of jquery on and off, similar to bind and unbind
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
| $(function() { | |
| $(window).on("mousemove", mouseMoveHandler); | |
| function mouseMoveHandler(e) { | |
| var pos = e.clientY; | |
| console.log(pos); | |
| if (pos < 15) { | |
| //key take away, is once you've got the event you want to trigger, it's good to "Turn OFF" the listner | |
| $(window).off( "mousemove", mouseMoveHandler ); | |
| $(".footer-popup").animate({ | |
| bottom: 0 | |
| }, 700); | |
| $(".closeit, .button").click(function(e) { | |
| $(".footer-popup").animate({ | |
| bottom: -100 | |
| }, 400); | |
| e.preventDefault(); | |
| }); | |
| } | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment