]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
fixes #7848 [Dropdown Menus] hoverDelay and closingTime not working right 7855/head
authorjk <j.koehler@modulingo.de>
Tue, 12 Jan 2016 17:14:38 +0000 (18:14 +0100)
committerjk <j.koehler@modulingo.de>
Tue, 12 Jan 2016 17:14:38 +0000 (18:14 +0100)
js/foundation.dropdownMenu.js

index 96b35af4656e744210e1c9365889fce5ece57612..250d3bfdd822821310e64b05c35c29c246b78190 100644 (file)
   DropdownMenu.prototype._events = function(){
     var _this = this,
         hasTouch = 'ontouchstart' in window || (typeof window.ontouchstart !== 'undefined'),
-        parClass = 'is-dropdown-submenu-parent',
-        delay;
+        parClass = 'is-dropdown-submenu-parent';
 
     if(this.options.clickOpen || hasTouch){
       this.$menuItems.on('click.zf.dropdownmenu touchstart.zf.dropdownmenu', function(e){
             hasSub = $elem.hasClass(parClass);
 
         if(hasSub){
-          clearTimeout(delay);
-          delay = setTimeout(function(){
+          clearTimeout(_this.delay);
+          _this.delay = setTimeout(function(){
             _this._show($elem.children('.is-dropdown-submenu'));
           }, _this.options.hoverDelay);
         }
         if(hasSub && _this.options.autoclose){
           if($elem.attr('data-is-click') === 'true' && _this.options.clickOpen){ return false; }
 
-          // clearTimeout(delay);
-          delay = setTimeout(function(){
+          clearTimeout(_this.delay);
+          _this.delay = setTimeout(function(){
             _this._hide($elem);
           }, _this.options.closingTime);
         }