diff --git a/js/jquery.flexnav.js b/js/jquery.flexnav.js
index d8f6bf9..04965ff 100644
--- a/js/jquery.flexnav.js
+++ b/js/jquery.flexnav.js
@@ -88,9 +88,10 @@
if (settings.calcItemWidths === true) {
$top_nav_items.css('width', nav_percent);
}
- $nav.removeClass('flexnav-show').find('.item-with-ul').on();
- $('.item-with-ul').find('ul').removeClass('flexnav-show');
- resetMenu();
+ $nav.removeClass('flexnav-show');
+ $('.item-with-ul').find('ul.flexnav-show').each(function(){
+ resetMenu.call($(this).parent().get(0));
+ });
if (settings.hoverIntent === true) {
return $('.item-with-ul').hoverIntent({
over: showMenu,
@@ -98,7 +99,7 @@
timeout: settings.hoverIntentTimeout
});
} else if (settings.hoverIntent === false) {
- return $('.item-with-ul').on('mouseenter', showMenu).on('mouseleave', resetMenu);
+ return $('.item-with-ul').off().on('mouseenter', showMenu).on('mouseleave', resetMenu);
}
}
};
diff --git a/js/jquery.flexnav.min.js b/js/jquery.flexnav.min.js
index f139606..feed539 100644
--- a/js/jquery.flexnav.min.js
+++ b/js/jquery.flexnav.min.js
@@ -1,2 +1,2 @@
/*! flexnav https://github.com/indyplanets/flexnav http://unlicense.org/ 2013-11-28 */
-!function(){var a;a=jQuery,a.fn.flexNav=function(b){var c,d,e,f,g,h,i,j,k,l,m,n;return k=a.extend({animationSpeed:250,transitionOpacity:!0,buttonSelector:".menu-button",hoverIntent:!1,hoverIntentTimeout:150,calcItemWidths:!1,hover:!0},b),c=a(this),c.addClass("with-js"),k.transitionOpacity===!0&&c.addClass("opacity"),c.find("li").each(function(){return a(this).has("ul").length?a(this).addClass("item-with-ul").find("ul").hide():void 0}),k.calcItemWidths===!0&&(d=c.find(">li"),f=d.length,h=100/f,g=h+"%"),c.data("breakpoint")&&(e=c.data("breakpoint")),l=function(){return c.hasClass("lg-screen")===!0&&k.hover===!0?k.transitionOpacity===!0?a(this).find(">ul").addClass("flexnav-show").stop(!0,!0).animate({height:["toggle","swing"],opacity:"toggle"},k.animationSpeed):a(this).find(">ul").addClass("flexnav-show").stop(!0,!0).animate({height:["toggle","swing"]},k.animationSpeed):void 0},i=function(){return c.hasClass("lg-screen")===!0&&a(this).find(">ul").hasClass("flexnav-show")===!0&&k.hover===!0?k.transitionOpacity===!0?a(this).find(">ul").removeClass("flexnav-show").stop(!0,!0).animate({height:["toggle","swing"],opacity:"toggle"},k.animationSpeed):a(this).find(">ul").removeClass("flexnav-show").stop(!0,!0).animate({height:["toggle","swing"]},k.animationSpeed):void 0},j=function(){var b;if(a(window).width()<=e)return c.removeClass("lg-screen").addClass("sm-screen"),k.calcItemWidths===!0&&d.css("width","100%"),b=k.buttonSelector+", "+k.buttonSelector+" .touch-button",a(b).removeClass("active"),a(".one-page li a").on("click",function(){return c.removeClass("flexnav-show")});if(a(window).width()>e){if(c.removeClass("sm-screen").addClass("lg-screen"),k.calcItemWidths===!0&&d.css("width",g),c.removeClass("flexnav-show").find(".item-with-ul").on(),a(".item-with-ul").find("ul").removeClass("flexnav-show"),i(),k.hoverIntent===!0)return a(".item-with-ul").hoverIntent({over:l,out:i,timeout:k.hoverIntentTimeout});if(k.hoverIntent===!1)return a(".item-with-ul").on("mouseenter",l).on("mouseleave",i)}},a(k.buttonSelector).data("navEl",c),n=".item-with-ul, "+k.buttonSelector,a(n).append('▼'),m=k.buttonSelector+", "+k.buttonSelector+" .touch-button",a(m).on("click",function(b){var c,d,e;return a(m).toggleClass("active"),b.preventDefault(),b.stopPropagation(),e=k.buttonSelector,c=a(this).is(e)?a(this):a(this).parent(e),d=c.data("navEl"),d.toggleClass("flexnav-show")}),a(".touch-button").on("click",function(){var b,d;return b=a(this).parent(".item-with-ul").find(">ul"),d=a(this).parent(".item-with-ul").find(">span.touch-button"),c.hasClass("lg-screen")===!0&&a(this).parent(".item-with-ul").siblings().find("ul.flexnav-show").removeClass("flexnav-show").hide(),b.hasClass("flexnav-show")===!0?(b.removeClass("flexnav-show").slideUp(k.animationSpeed),d.removeClass("active")):b.hasClass("flexnav-show")===!1?(b.addClass("flexnav-show").slideDown(k.animationSpeed),d.addClass("active")):void 0}),c.find(".item-with-ul *").focus(function(){return a(this).parent(".item-with-ul").parent().find(".open").not(this).removeClass("open").hide(),a(this).parent(".item-with-ul").find(">ul").addClass("open").show()}),j(),a(window).on("resize",j)}}.call(this);
\ No newline at end of file
+(function(){var t;t=jQuery,t.fn.flexNav=function(e){var n,i,s,a,o,l,h,r,u,d,c,v;return u=t.extend({animationSpeed:250,transitionOpacity:!0,buttonSelector:".menu-button",hoverIntent:!1,hoverIntentTimeout:150,calcItemWidths:!1,hover:!0},e),n=t(this),n.addClass("with-js"),u.transitionOpacity===!0&&n.addClass("opacity"),n.find("li").each(function(){return t(this).has("ul").length?t(this).addClass("item-with-ul").find("ul").hide():void 0}),u.calcItemWidths===!0&&(i=n.find(">li"),a=i.length,l=100/a,o=l+"%"),n.data("breakpoint")&&(s=n.data("breakpoint")),d=function(){return n.hasClass("lg-screen")===!0&&u.hover===!0?u.transitionOpacity===!0?t(this).find(">ul").addClass("flexnav-show").stop(!0,!0).animate({height:["toggle","swing"],opacity:"toggle"},u.animationSpeed):t(this).find(">ul").addClass("flexnav-show").stop(!0,!0).animate({height:["toggle","swing"]},u.animationSpeed):void 0},h=function(){return n.hasClass("lg-screen")===!0&&t(this).find(">ul").hasClass("flexnav-show")===!0&&u.hover===!0?u.transitionOpacity===!0?t(this).find(">ul").removeClass("flexnav-show").stop(!0,!0).animate({height:["toggle","swing"],opacity:"toggle"},u.animationSpeed):t(this).find(">ul").removeClass("flexnav-show").stop(!0,!0).animate({height:["toggle","swing"]},u.animationSpeed):void 0},r=function(){var e;if(t(window).width()<=s)return n.removeClass("lg-screen").addClass("sm-screen"),u.calcItemWidths===!0&&i.css("width","100%"),e=u.buttonSelector+", "+u.buttonSelector+" .touch-button",t(e).removeClass("active"),t(".one-page li a").on("click",function(){return n.removeClass("flexnav-show")});if(t(window).width()>s){if(n.removeClass("sm-screen").addClass("lg-screen"),u.calcItemWidths===!0&&i.css("width",o),n.removeClass("flexnav-show"),t(".item-with-ul").find("ul.flexnav-show").each(function(){h.call(t(this).parent().get(0))}),u.hoverIntent===!0)return t(".item-with-ul").hoverIntent({over:d,out:h,timeout:u.hoverIntentTimeout});if(u.hoverIntent===!1)return t(".item-with-ul").off().on("mouseenter",d).on("mouseleave",h)}},t(u.buttonSelector).data("navEl",n),v=".item-with-ul, "+u.buttonSelector,t(v).append('▼'),c=u.buttonSelector+", "+u.buttonSelector+" .touch-button",t(c).on("click",function(e){var n,i,s;return t(c).toggleClass("active"),e.preventDefault(),e.stopPropagation(),s=u.buttonSelector,n=t(this).is(s)?t(this):t(this).parent(s),i=n.data("navEl"),i.toggleClass("flexnav-show")}),t(".touch-button").on("click",function(){var e,i;return e=t(this).parent(".item-with-ul").find(">ul"),i=t(this).parent(".item-with-ul").find(">span.touch-button"),n.hasClass("lg-screen")===!0&&t(this).parent(".item-with-ul").siblings().find("ul.flexnav-show").removeClass("flexnav-show").hide(),e.hasClass("flexnav-show")===!0?(e.removeClass("flexnav-show").slideUp(u.animationSpeed),i.removeClass("active")):e.hasClass("flexnav-show")===!1?(e.addClass("flexnav-show").slideDown(u.animationSpeed),i.addClass("active")):void 0}),n.find(".item-with-ul *").focus(function(){return t(this).parent(".item-with-ul").parent().find(".open").not(this).removeClass("open").hide(),t(this).parent(".item-with-ul").find(">ul").addClass("open").show()}),r(),t(window).on("resize",r)}}).call(this);
\ No newline at end of file