在ipad中,onclick事件在div上不起作用。在imageFlow代码中,我用div替换了所有的图片,但是在ipad上点击事件不起作用。
我试着把点击后的following改成touch和touchstart,但都没效果。
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()="“
发布于 2013-06-07 13:18:07
试试这个:-
var ua = navigator.userAgent,
event = (ua.match(/iPad/i)) ? "touchstart" : "click";
$(image).bind(event, function(e) {
//do your stuff here
}发布于 2013-06-07 15:04:16
对于触摸事件,使用这个。
$('image').on('vclick', function() {
// your scripts...
});https://stackoverflow.com/questions/16976614
复制相似问题