From d6f9592840a011867ee76671db2c4a31383f3f40 Mon Sep 17 00:00:00 2001 From: Anish Mistry Date: Wed, 25 May 2016 19:19:24 -0400 Subject: [PATCH] fix multiple nested submenu expansion --- dropit.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/dropit.js b/dropit.js index 8106db4..af478a2 100644 --- a/dropit.js +++ b/dropit.js @@ -28,21 +28,21 @@ // Open on click $el.off(settings.action).on(settings.action, settings.triggerParentEl +':has('+ settings.submenuEl +') > '+ settings.triggerEl +'', function(){ // Close click menu's if clicked again - if(settings.action == 'click' && $(this).parents(settings.triggerParentEl).hasClass('dropit-open')){ + if(settings.action == 'click' && $(this).parent(settings.triggerParentEl).hasClass('dropit-open')){ settings.beforeHide.call(this); - $(this).parents(settings.triggerParentEl).removeClass('dropit-open').find(settings.submenuEl).hide(); + $(this).parent(settings.triggerParentEl).removeClass('dropit-open').children(settings.submenuEl).hide(); settings.afterHide.call(this); return false; } // Hide open menus settings.beforeHide.call(this); - $('.dropit-open').removeClass('dropit-open').find('.dropit-submenu').hide(); + $('.dropit-open').removeClass('dropit-open').children('.dropit-submenu').hide(); settings.afterHide.call(this); // Open this menu settings.beforeShow.call(this); - $(this).parents(settings.triggerParentEl).addClass('dropit-open').find(settings.submenuEl).show(); + $(this).parents(settings.triggerParentEl).addClass('dropit-open').children(settings.submenuEl).show(); settings.afterShow.call(this); return false; @@ -51,7 +51,7 @@ // Close if outside click $(document).on('click', function(){ settings.beforeHide.call(this); - $('.dropit-open').removeClass('dropit-open').find('.dropit-submenu').hide(); + $('.dropit-open').removeClass('dropit-open').children('.dropit-submenu').hide(); settings.afterHide.call(this); });