我有一个jQuery脚本来管理我的图像的滚动。我的脚本在PC上运行良好,但不幸的是,这个脚本与iDevices (iPad,iPhone)不兼容。
image-normal.jpg <=> image-hover.jpg
你能帮帮我吗?
$(document).ready(function(){
$(function () {
$('img.rollover').hover(function () {
$(this).css("cursor", "pointer");
this.src = this.src.replace("-normal","-hover");
}, function () {
this.src = this.src.replace("-hover","-normal");
});
});
});发布于 2013-12-13 18:02:49
试试这个:
$(document).ready(function(){
$(function () {
$('img.rollover').on('mouseenter touchstart', function(){
$(this).css("cursor", "pointer");
this.src = this.src.replace("-normal","-hover");
});
$('img.rollover').on('mouseleave touchend', function(){
this.src = this.src.replace("-hover","-normal");
});
});
});您仍然需要触摸(点击)移动图像,因为没有悬停。
https://stackoverflow.com/questions/20572972
复制相似问题