lakhwinder
lakhwinder

Reputation: 1

Click isn't working in iPhone

My element click event works perfectly on Android, but not working in iOS. Please help me.

HTML code:

<div class="img-thumbnail" src="../image/<?=$Image?>" data-toggle="modal" data-target="#myModal" data-image="../image/<?=$Image?>" style="width: 100%; height: 250px; overflow:hidden; display:block; background:url('../air/w250-h250/<?=$Image?>'); background-size:100%; background-repeat:no-repeat"></div>     

jQuery code:

$('#myModal').on('show.bs.modal',function(event){
     var button = $(event.relatedTarget) // Button that triggered the modal
     $("#imagePrv").html('<img src="'+button.data('image')+'"width="100%" height="100%">');                 
})

Upvotes: 0

Views: 72

Answers (2)

Jai
Jai

Reputation: 74738

I can suggest you this here:

  1. Either remove the type of the js or change to type="text/javascript".

 <script type="text/javascript">
     // modal code.
 </script>

Upvotes: 0

vishwa
vishwa

Reputation: 430

try using the touchstart method for IOS

$(element).on("touchstart", function (e) {

}

some usefull tips

Upvotes: 2

Related Questions