Skip to content

Instantly share code, notes, and snippets.

@nola
Last active December 29, 2015 09:28
Show Gist options
  • Select an option

  • Save nola/7650145 to your computer and use it in GitHub Desktop.

Select an option

Save nola/7650145 to your computer and use it in GitHub Desktop.
example of jquery on and off, similar to bind and unbind
$(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