2

Here is my code:

     var tmp = plugin.main_video_src.split("_")[1]

     if(tmp == 2)
     {
        $('.flex-direction-nav .flex-next').click();
     }

This works perfectly in PC browser, But its not working in iPad. Any solution?

Advance Thanks.

byJeevan
  • 3,728
  • 3
  • 37
  • 60
vijay0056
  • 91
  • 2
  • 4

4 Answers4

3

It could be because you're trying to react to events on an html element that isn't clickable. This tutorial will explain how

Making Elements Clickable

Because of the way Safari on iOS creates events to emulate a mouse, some of your elements may not behave as expected on iOS. In particular, some menus that only use mousemove handlers, as in Listing 6-1, need to be changed because iOS doesn’t recognize them as clickable elements.

Listing 6-1 A menu using a mouseover handler

<span onmouseover = "..."
  onmouseout  = "..."
 
WHERE TO BUY
 
</span>

To fix this, add a dummy onclick handler, onclick = "void(0)", so that Safari on iOS recognizes the span element as a clickable element, as shown in Listing 6-2.

Listing 6-2 Adding an onclick handler

<span onmouseover = "..."
  onmouseout  = "..."
  onclick = "void(0)">
 
WHERE TO BUY
 
</span>
Community
  • 1
  • 1
Daniel Kaplan
  • 62,768
  • 50
  • 234
  • 356
1

I used "touchstart" event instead of "click" event. It works perfectly for me. Here is the sample code :

$("<selector>").bind("touchstart", function() {

// YOUR CODE ...
});
0

OnClick event doesn't exist on the IPad. You need the touch event

$('.flex-direction-nav .flex-next').trigger('touchstart');

document.addEventListener('touchstart', function(e) {
    //Bind your event here
}, false);

You have the following events

  1. touchstart
  2. touchmove
  3. touchend
  4. touchcancel

How to recognize touch events using jQuery in Safari for iPad? Is it possible?

Community
  • 1
  • 1
LiamB
  • 18,243
  • 19
  • 75
  • 116
0

I have the same issue. This is what worked for me.

$('.flex-direction-nav .flex-next').off('click').on('click');
user1937747
  • 160
  • 6