Created
October 17, 2012 06:56
-
-
Save rambuvn/3904100 to your computer and use it in GitHub Desktop.
menu hover on touch-able device
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//MENU HOVER ON TOUCH-able DEVICE | |
if( 'ontouchstart' in document.documentElement ){ | |
var clickable = null; | |
$('.touchable').each(function(){ | |
var $this = $(this); | |
if( $this.find('ul.sub-menu').length > 0 ){ | |
$this.find('a:first').unbind('click').bind('touchstart',function(event){ | |
if( clickable != this ){ | |
clickable = this; | |
event.preventDefault(); | |
}else{ | |
clickable = null; | |
} | |
}); | |
} | |
}); | |
} | |
// END MENU HOVER ON TOUCH-ABLE DEVICE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment