div onclick无法在imageFlow ipad中工作

时间:2013-06-07 05:08:45

标签: jquery html css ipad

在ipad onclick事件中没有使用div。在imageFlow代码中,我已经用div替换了所有图像,但是在点击事件上的ipad上无效。

我尝试更改以下点击触摸和触摸启动,但没有任何工作。

switch (image.i == my.imageID) {
    case false:

        image.onclick = function () {
            //$('.slideDiv').removeClass('imgnew');                         
            alert('each time called');
            my.glideTo(this.i);
        };
        break;

    default:
        this.zIndex = my.zIndex + 1;
        if (image.url !== '') {
            image.onclick = my.onClick;

        }
        break;
}

我试过,

$(image).click()
$(image).live('click toch touchstart', function () {
    // ...
});

添加光标指针 在div上添加onClick()=“”

2 个答案:

答案 0 :(得分:0)

试试这个: -

var ua = navigator.userAgent,
event = (ua.match(/iPad/i)) ? "touchstart" : "click";

$(image).bind(event, function(e) {
   //do your stuff here
}

答案 1 :(得分:0)

对于触摸事件,请使用此功能。

$('image').on('vclick', function() {
    // your scripts...      
});