]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
fixes #7031
authorzurbchris <chris@zurb.com>
Thu, 19 Nov 2015 23:38:07 +0000 (15:38 -0800)
committerzurbchris <chris@zurb.com>
Thu, 19 Nov 2015 23:38:07 +0000 (15:38 -0800)
js/foundation.dropdownMenu.js

index 4ed9bcbd512752500104cfe18691dbbc20b2bc35..cde10c88b0c3cdc1fbe10b9a28418ec40b4f71bf 100644 (file)
     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){
     Foundation.Nest.Burn(this.$element, 'dropdown');
     Foundation.unregisterPlugin(this);
   };
-  
+
   Foundation.plugin(DropdownMenu, 'DropdownMenu');
 
   var checkClass = function($elem){