Created
June 1, 2013 13:51
-
-
Save lawrencebrown/5690465 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
var adjustMenu = function() { | |
if (ww < 768) { | |
$(".toggleMenu").css("display", "inline-block"); | |
if (!$(".toggleMenu").hasClass("active")) { | |
$(".nav").hide(); | |
} else { | |
$(".nav").show(); | |
} | |
$(".nav li").unbind('mouseenter mouseleave'); | |
$(".nav li a.parent").unbind('click').bind('click', function(e) { | |
// must be attached to anchor element to prevent bubbling | |
e.preventDefault(); | |
$(this).parent("li").toggleClass("hover"); | |
}); | |
} | |
else if (ww >= 768) { | |
$(".toggleMenu").css("display", "none"); | |
$(".nav").show(); | |
$(".nav li").removeClass("hover"); | |
$(".nav li a").unbind('click'); | |
$(".nav li").unbind('mouseenter mouseleave').bind('mouseenter mouseleave', function() { | |
// must be attached to li so that mouseleave is not triggered when hover over submenu | |
$(this).toggleClass('hover'); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment