]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
Fixes #9823 10921/head
authorAbdullah Salem <abdullahsalem@outlook.com>
Tue, 6 Feb 2018 14:47:52 +0000 (17:47 +0300)
committerAbdullah Salem <abdullahsalem@outlook.com>
Tue, 6 Feb 2018 14:47:52 +0000 (17:47 +0300)
js/foundation.dropdownMenu.js

index 573116140b7aedb6b2b75ef839b961d7f97a1981..5d41f78d27ba434b1270e44a625f10ca3c66aa9d 100644 (file)
@@ -74,6 +74,7 @@ class DropdownMenu extends Plugin {
       }
     }
     this.changed = false;
+    this.isTouchMove = false;
     this._events();
   };
 
@@ -270,13 +271,20 @@ class DropdownMenu extends Plugin {
   _addBodyHandler() {
     var $body = $(document.body),
         _this = this;
-    $body.off('mouseup.zf.dropdownmenu touchend.zf.dropdownmenu')
+    $body.off('touchmove.zf.dropdownmenu')
+         .on('touchmove.zf.dropdownmenu', function(){
+           _this.isTouchMove = true;
+         })
+         .off('mouseup.zf.dropdownmenu touchend.zf.dropdownmenu')
          .on('mouseup.zf.dropdownmenu touchend.zf.dropdownmenu', function(e) {
            var $link = _this.$element.find(e.target);
-           if ($link.length) { return; }
+           if ($link.length || _this.isTouchMove){
+             _this.isTouchMove = false;
+             return;
+           }
 
            _this._hide();
-           $body.off('mouseup.zf.dropdownmenu touchend.zf.dropdownmenu');
+           $body.off('mouseup.zf.dropdownmenu touchend.zf.dropdownmenu touchmove.zf.dropdownmenu');
          });
   }