Clickstart touch event not working for iPhone / iPade

I wrote an event to open a new browser tab ( window.open ) using jQuery, as shown below:

 $(document).on('touchstart click', '.myClass', {self: this}, function (e) { var mylink = e.data.self.validateDomValue(this, 'attr=data-affiliate') if(myLink) { window.open(mylink, '_blank'); } }); 

These scripts work well for Windows, Mac and iPad, but the problem arises for the iPhone. The event does not shoot on the iPhone (version: 5, 6 and 7). What was my mistake? Any of your suggestions will be appreciated.

+5
source share
1 answer

ABOUT! Yes! I understood. I need to use css cursor:pointer . This works for me.

 if (/iP(hone|od|ad)/.test(navigator.platform)) { $(".myClass").css({"cursor":"pointer"}); } 
+2
source

Source: https://habr.com/ru/post/1268861/


All Articles