diff --git a/js/jquery.flexnav.js b/js/jquery.flexnav.js
index af17678..ed7f05c 100644
--- a/js/jquery.flexnav.js
+++ b/js/jquery.flexnav.js
@@ -1,7 +1,7 @@
/*
- FlexNav.js 1.0
+ FlexNav.js 1.1
- Copyright 2013, Jason Weaver http://jasonweaver.name
+ Created by Jason Weaver http://jasonweaver.name
Released under http://unlicense.org/
//
@@ -14,7 +14,7 @@
$ = jQuery;
$.fn.flexNav = function(options) {
- var $nav, breakpoint, resetMenu, resizer, selector, settings, showMenu;
+ var $nav, breakpoint, flag, resetMenu, resizer, selector, settings, showMenu;
settings = $.extend({
'animationSpeed': 250,
'transitionOpacity': true,
@@ -23,6 +23,7 @@
'hoverIntentTimeout': 150
}, options);
$nav = $(this);
+ flag = false;
$nav.addClass('with-js');
if (settings.transitionOpacity === true) {
$nav.addClass('opacity');
@@ -94,7 +95,13 @@
bs = settings['buttonSelector'];
$btnParent = $(this).is(bs) ? $(this) : $(this).parent(bs);
$thisNav = $btnParent.data('navEl');
- return $thisNav.toggleClass('show');
+ if (flag === false) {
+ flag = true;
+ setTimeout(function() {
+ return flag = false;
+ }, 100);
+ return $thisNav.toggleClass('show');
+ }
});
$('.touch-button').on('touchstart click', function(e) {
var $sub, $touchButton;
@@ -102,15 +109,21 @@
e.stopPropagation();
$sub = $(this).parent('.item-with-ul').find('>ul');
$touchButton = $(this).parent('.item-with-ul').find('>span.touch-button');
- if ($nav.hasClass('lg-screen') === true) {
- $(this).parent('.item-with-ul').siblings().find('ul.show').removeClass('show').hide();
- }
- if ($sub.hasClass('show') === true) {
- $sub.removeClass('show').slideUp(settings.animationSpeed);
- return $touchButton.removeClass('active');
- } else if ($sub.hasClass('show') === false) {
- $sub.addClass('show').slideDown(settings.animationSpeed);
- return $touchButton.addClass('active');
+ if (flag === false) {
+ flag = true;
+ setTimeout(function() {
+ return flag = false;
+ }, 100);
+ if ($nav.hasClass('lg-screen') === true) {
+ $(this).parent('.item-with-ul').siblings().find('ul.show').removeClass('show').hide();
+ }
+ if ($sub.hasClass('show') === true) {
+ $sub.removeClass('show').slideUp(settings.animationSpeed);
+ return $touchButton.removeClass('active');
+ } else if ($sub.hasClass('show') === false) {
+ $sub.addClass('show').slideDown(settings.animationSpeed);
+ return $touchButton.addClass('active');
+ }
}
});
$nav.find('.item-with-ul *').focus(function() {
diff --git a/js/jquery.flexnav.min.js b/js/jquery.flexnav.min.js
index c38adac..70072e9 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-08-05 */
-!function(){var a;a=jQuery,a.fn.flexNav=function(b){var c,d,e,f,g,h,i;return h=a.extend({animationSpeed:250,transitionOpacity:!0,buttonSelector:".menu-button",hoverIntent:!1,hoverIntentTimeout:150},b),c=a(this),c.addClass("with-js"),h.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}),c.data("breakpoint")&&(d=c.data("breakpoint")),i=function(){return c.hasClass("lg-screen")===!0?h.transitionOpacity===!0?a(this).find(">ul").addClass("show").stop(!0,!0).animate({height:["toggle","swing"],opacity:"toggle"},h.animationSpeed):a(this).find(">ul").addClass("show").stop(!0,!0).animate({height:["toggle","swing"]},h.animationSpeed):void 0},e=function(){return c.hasClass("lg-screen")===!0&&a(this).find(">ul").hasClass("show")===!0?h.transitionOpacity===!0?a(this).find(">ul").removeClass("show").stop(!0,!0).animate({height:["toggle","swing"],opacity:"toggle"},h.animationSpeed):a(this).find(">ul").removeClass("show").stop(!0,!0).animate({height:["toggle","swing"]},h.animationSpeed):void 0},f=function(){if(a(window).width()<=d)return c.removeClass("lg-screen").addClass("sm-screen"),a(".one-page li a").on("click",function(){return c.removeClass("show")});if(a(window).width()>d){if(c.removeClass("sm-screen").addClass("lg-screen"),c.removeClass("show"),h.hoverIntent===!0)return a(".item-with-ul").hoverIntent({over:i,out:e,timeout:h.hoverIntentTimeout});if(h.hoverIntent===!1)return a(".item-with-ul").on("mouseenter",i).on("mouseleave",e)}},a(h.buttonSelector).data("navEl",c),g=".item-with-ul, "+h.buttonSelector,a(g).append('
▼'),g=h.buttonSelector+", "+h.buttonSelector+" .touch-button",a(g).on("touchstart click",function(b){var c,d,e;return b.preventDefault(),b.stopPropagation(),e=h.buttonSelector,c=a(this).is(e)?a(this):a(this).parent(e),d=c.data("navEl"),d.toggleClass("show")}),a(".touch-button").on("touchstart click",function(b){var d,e;return b.preventDefault(),b.stopPropagation(),d=a(this).parent(".item-with-ul").find(">ul"),e=a(this).parent(".item-with-ul").find(">span.touch-button"),c.hasClass("lg-screen")===!0&&a(this).parent(".item-with-ul").siblings().find("ul.show").removeClass("show").hide(),d.hasClass("show")===!0?(d.removeClass("show").slideUp(h.animationSpeed),e.removeClass("active")):d.hasClass("show")===!1?(d.addClass("show").slideDown(h.animationSpeed),e.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()}),f(),a(window).on("resize",f)}}.call(this);
\ No newline at end of file
+/*! flexnav https://github.com/indyplanets/flexnav http://unlicense.org/ 2013-08-11 */
+!function(){var a;a=jQuery,a.fn.flexNav=function(b){var c,d,e,f,g,h,i,j;return i=a.extend({animationSpeed:250,transitionOpacity:!0,buttonSelector:".menu-button",hoverIntent:!1,hoverIntentTimeout:150},b),c=a(this),e=!1,c.addClass("with-js"),i.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}),c.data("breakpoint")&&(d=c.data("breakpoint")),j=function(){return c.hasClass("lg-screen")===!0?i.transitionOpacity===!0?a(this).find(">ul").addClass("show").stop(!0,!0).animate({height:["toggle","swing"],opacity:"toggle"},i.animationSpeed):a(this).find(">ul").addClass("show").stop(!0,!0).animate({height:["toggle","swing"]},i.animationSpeed):void 0},f=function(){return c.hasClass("lg-screen")===!0&&a(this).find(">ul").hasClass("show")===!0?i.transitionOpacity===!0?a(this).find(">ul").removeClass("show").stop(!0,!0).animate({height:["toggle","swing"],opacity:"toggle"},i.animationSpeed):a(this).find(">ul").removeClass("show").stop(!0,!0).animate({height:["toggle","swing"]},i.animationSpeed):void 0},g=function(){if(a(window).width()<=d)return c.removeClass("lg-screen").addClass("sm-screen"),a(".one-page li a").on("click",function(){return c.removeClass("show")});if(a(window).width()>d){if(c.removeClass("sm-screen").addClass("lg-screen"),c.removeClass("show"),i.hoverIntent===!0)return a(".item-with-ul").hoverIntent({over:j,out:f,timeout:i.hoverIntentTimeout});if(i.hoverIntent===!1)return a(".item-with-ul").on("mouseenter",j).on("mouseleave",f)}},a(i.buttonSelector).data("navEl",c),h=".item-with-ul, "+i.buttonSelector,a(h).append('
▼'),h=i.buttonSelector+", "+i.buttonSelector+" .touch-button",a(h).on("touchstart click",function(b){var c,d,f;return b.preventDefault(),b.stopPropagation(),f=i.buttonSelector,c=a(this).is(f)?a(this):a(this).parent(f),d=c.data("navEl"),e===!1?(e=!0,setTimeout(function(){return e=!1},100),d.toggleClass("show")):void 0}),a(".touch-button").on("touchstart click",function(b){var d,f;if(b.preventDefault(),b.stopPropagation(),d=a(this).parent(".item-with-ul").find(">ul"),f=a(this).parent(".item-with-ul").find(">span.touch-button"),e===!1){if(e=!0,setTimeout(function(){return e=!1},100),c.hasClass("lg-screen")===!0&&a(this).parent(".item-with-ul").siblings().find("ul.show").removeClass("show").hide(),d.hasClass("show")===!0)return d.removeClass("show").slideUp(i.animationSpeed),f.removeClass("active");if(d.hasClass("show")===!1)return d.addClass("show").slideDown(i.animationSpeed),f.addClass("active")}}),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()}),g(),a(window).on("resize",g)}}.call(this);
\ No newline at end of file
diff --git a/package.json b/package.json
index 15fc40a..4356212 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "flexnav",
- "version": "0.8.0",
+ "version": "1.1",
"repository": "https://github.com/indyplanets/flexnav",
"license": "http://unlicense.org/",
"devDependencies": {
diff --git a/single-page-pattern.html b/single-page-pattern.html
index 821fd0a..1aa604d 100644
--- a/single-page-pattern.html
+++ b/single-page-pattern.html
@@ -85,7 +85,7 @@
Section 5