Skip to content

Instantly share code, notes, and snippets.

@rambuvn
Created October 17, 2012 06:56
Show Gist options
  • Save rambuvn/3904100 to your computer and use it in GitHub Desktop.
Save rambuvn/3904100 to your computer and use it in GitHub Desktop.
menu hover on touch-able device
//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