]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
Fix #9427 - Dropdown menu mouseout ignored
authorNicolas Coden <nicolas@ncoden.fr>
Sun, 4 Dec 2016 15:10:18 +0000 (16:10 +0100)
committerNicolas Coden <nicolas@ncoden.fr>
Sun, 4 Dec 2016 15:10:18 +0000 (16:10 +0100)
Fix https://github.com/zurb/foundation-sites/issues/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.

js/foundation.dropdownMenu.js

index 9661315d72a07e42d964846f87b397f467dd7b81..61f7cc1493b748e374d7d840b78e40b99caa85b8 100644 (file)
@@ -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);
         }
@@ -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);
         }