Skip to content

Commit

Permalink
Fix foundation#9427 - Dropdown menu mouseout ignored
Browse files Browse the repository at this point in the history
Fix foundation#9427

The hide delay of the visible dropdown is replaced by the delays of the
lastly triggered dropdown, so the hide function is never called on the
currently visible dropdown.

Remember and cancel the delay inside each element. So a visible
dropdown remember its hide delay even if several dropdown must be
hidden.
  • Loading branch information
ncoden committed Dec 4, 2016
1 parent 614d472 commit 5ec0102
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions js/foundation.dropdownMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ class DropdownMenu {
hasSub = $elem.hasClass(parClass);

if (hasSub) {
clearTimeout(_this.delay);
_this.delay = setTimeout(function() {
clearTimeout(this.delay);
this.delay = setTimeout(function() {
_this._show($elem.children('.is-dropdown-submenu'));
}, _this.options.hoverDelay);
}
Expand All @@ -129,8 +129,8 @@ class DropdownMenu {
if (hasSub && _this.options.autoclose) {
if ($elem.attr('data-is-click') === 'true' && _this.options.clickOpen) { return false; }

clearTimeout(_this.delay);
_this.delay = setTimeout(function() {
clearTimeout(this.delay);
this.delay = setTimeout(function() {
_this._hide($elem);
}, _this.options.closingTime);
}
Expand Down

0 comments on commit 5ec0102

Please sign in to comment.