javascript - How do I avoid hover event to fire in iPhone and iPad? -


i had added effect on hoverenter , hoverleave on divs assuming these events wont fire on ios devices. on ios devices hoverenter , click event fire , hoverenter effect maintained. dont want these hover events fire on mobile devices. should do. attaching event via javascript , hover event attached div before click event.

to emulate hover add event listener element want have hover event, can use touchstart , touchend events instead of using hover

if((navigator.useragent.match(/iphone/i)) || (navigator.useragent.match(/ipod/i)) || (navigator.useragent.match(/ipad/i))) {     $(".menu li a").bind('touchstart', function(){         console.log("touch started");     });     $(".menu li a").bind('touchend', function(){         console.log("touch ended");     }); } 

Comments

Popular posts from this blog

gcc - MinGW's ld cannot perform PE operations on non PE output file -

timeout - Handshake_timeout on RabbitMQ using python and pika from remote vm -

c# - Search and Add Comment with OpenXML for Word -