From: zurbchris Date: Thu, 19 Nov 2015 23:38:07 +0000 (-0800) Subject: fixes #7031 X-Git-Tag: v6.0.1~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1de4ee9e14d043a6b32b16f852c7cee878949c14;p=thirdparty%2Ffoundation%2Ffoundation-sites.git fixes #7031 --- diff --git a/js/foundation.dropdownMenu.js b/js/foundation.dropdownMenu.js index 4ed9bcbd5..cde10c88b 100644 --- a/js/foundation.dropdownMenu.js +++ b/js/foundation.dropdownMenu.js @@ -177,25 +177,26 @@ var _this = this; if(this.options.clickOpen){ - $elem.children('a').on('click.zf.dropdownmenu touchend.zf.dropdownmenu', function(e){ - if($(e.target).parent('li').hasClass('has-submenu')){ - e.preventDefault(); - e.stopPropagation(); - }else{ - return; - } + $elem.off('click.zf.dropdownmenu') + .on('click.zf.dropdownmenu', function(e){ + if(!$(this).hasClass('is-dropdown-submenu-parent')){ return; } - if($elem.data('isClick')){ - _this._hide($elem); - }else{ - _this._hideOthers($elem); - _this._show($elem); - $elem.data('isClick', true).parentsUntil('[data-dropdown-menu]', '.has-submenu').data('isClick', true); - if(_this.options.closeOnClick){ - _this._addBodyHandler(); - } - } - }); + e.preventDefault(); + e.stopPropagation(); + + if($elem.data('isClick')){ + _this._hide($elem); + }else{ + _this._hideOthers($elem); + _this._show($elem); + $elem.data('isClick', true) + .parentsUntil('[data-dropdown-menu]', '.is-dropdown-submenu-parent') + .data('isClick', true); + if(_this.options.closeOnClick){ + _this._addBodyHandler(); + } + } + }); } if(!this.options.disableHover){ @@ -457,7 +458,7 @@ Foundation.Nest.Burn(this.$element, 'dropdown'); Foundation.unregisterPlugin(this); }; - + Foundation.plugin(DropdownMenu, 'DropdownMenu'); var checkClass = function($elem){