Friday, 9 August 2013

jQuery: Executing if more than 150px from top

jQuery: Executing if more than 150px from top

I need help to execute the mouseenter and mouseleave function only if you
have scrolled 150px or more...
$(document).ready(function(){
$(document).scroll(function() {
var top = $(document).scrollTop();
if (top > 150) $(".menywrapper").mouseenter(function(){
$(".main-navigation").removeClass( "nav-closed", 200, "linear" );
});
if (top > 150) $(".menywrapper").mouseleave(function(){
$(".main-navigation").addClass( "nav-closed", 200, "linear" ); });
});

No comments:

Post a Comment