]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
adds method to click through a dropdownmenu link on second tap on touch device
authorzurbchris <chris@zurb.com>
Fri, 20 Nov 2015 18:31:38 +0000 (10:31 -0800)
committerzurbchris <chris@zurb.com>
Fri, 20 Nov 2015 18:31:38 +0000 (10:31 -0800)
js/foundation.dropdownMenu.js

index c65273cdb56415e738a203ed951ce066f0d69883..dbbf4d1ee036f6d91fef96cf1e9c83c6a9a3567b 100644 (file)
    * @function
    */
   DropdownMenu.prototype._events = function($elem){
-    var _this = this;
-
-    if(this.options.clickOpen || 'ontouchstart' in window){
+    var _this = this,
+        isTouch = window.ontouchstart !== undefined;
+        
+    if(this.options.clickOpen || isTouch){
       $elem.off('click.zf.dropdownmenu')
           .on('click.zf.dropdownmenu', function(e){
             if(!$(this).hasClass('is-dropdown-submenu-parent')){ return; }
-
-
+            var hasClicked = $elem.data('isClick');
+            if(isTouch && hasClicked) return;
             e.preventDefault();
             e.stopPropagation();