0

In a PC, Mac and any Android device, when you click or touch an image, the showItem function is called, and I display the image in full screen mode.

However, when I test this in Iphone / iPad, when you first touch the image, the hover event is fired, and you need to touch another time to actually activate the function. How can I overcome this?

jQuery

this1.on("click", function(evt){ 
    evt.preventDefault();
    evt.stopPropagation();
    showItem(this1);
});

PS: the this1 variable, is the img with the .item class below

HTML / PHP

<div class='galleryImage'>
    <span class='hidden' title='images/galleries/".$category."/".$dir[$i]."' ></span>
    <img class='item image' src='images/galleries/".$category."/".$dir[$i]."' alt='image-jpg' />
    <img src='images/ajax-small.gif' class='galleryLoader' alt='galleryLoader' />
</div>
gdoron
  • 147,333
  • 58
  • 291
  • 367

1 Answers1

1

Try tap. Make sure you load jQuery mobile as well.

this1.on("tap", function() {
    // your function here
});

See also

Community
  • 1
  • 1
Antony
  • 14,900
  • 10
  • 46
  • 74