Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix multiple nested submenu expansion #26

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions dropit.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
});

Expand Down