From 490b0d6716a9e35eb4d32b3249f52699e06310bd Mon Sep 17 00:00:00 2001 From: Nicolas Coden Date: Wed, 14 Dec 2016 18:40:46 +0100 Subject: [PATCH] Use jQuery data instead of this to save delay It allow to destroy the saved datas more easily. --- js/foundation.dropdownMenu.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/js/foundation.dropdownMenu.js b/js/foundation.dropdownMenu.js index 61f7cc149..661eed9a9 100644 --- a/js/foundation.dropdownMenu.js +++ b/js/foundation.dropdownMenu.js @@ -118,21 +118,22 @@ class DropdownMenu { hasSub = $elem.hasClass(parClass); if (hasSub) { - clearTimeout(this.delay); - this.delay = setTimeout(function() { + clearTimeout($elem.data('_delay')); + $elem.data('_delay', setTimeout(function() { _this._show($elem.children('.is-dropdown-submenu')); - }, _this.options.hoverDelay); + }, _this.options.hoverDelay)); } }).on('mouseleave.zf.dropdownmenu', function(e) { var $elem = $(this), + elemStore = Foundation.ElemStore(this).store, hasSub = $elem.hasClass(parClass); 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($elem.data('_delay')); + $elem.data('_delay', setTimeout(function() { _this._hide($elem); - }, _this.options.closingTime); + }, _this.options.closingTime)); } }); } -- 2.47.2