]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
Use jQuery data instead of this to save delay 9443/head
authorNicolas Coden <nicolas@ncoden.fr>
Wed, 14 Dec 2016 17:40:46 +0000 (18:40 +0100)
committerNicolas Coden <nicolas@ncoden.fr>
Wed, 14 Dec 2016 17:40:46 +0000 (18:40 +0100)
It allow to destroy the saved datas more easily.

js/foundation.dropdownMenu.js

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