jQuery脚本滚动在iDevices上不兼容
jQuery script rollover not compatible on iDevices
我有一个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");
});
});
});
试试这个:
$(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");
});
});
});
你仍然需要触摸(点击)手机上的图像,因为没有悬停。
相关文章:
- TypeError:在不兼容的接收器nodejs上调用了方法Uint8Array.length
- CKJustify和Color Button插件之间的不兼容
- 在不兼容的接收器上调用的方法Set.prototype.add未定义
- 如果不兼容,则隐藏范围输入
- 谷歌图表 - 地理图表“不兼容的数据表:错误:未知地址类型
- IE11真的与getNamedItem()JS函数不兼容吗
- 与您的操作系统或体系结构不兼容:fsevents@1.0.11.
- jQuery脚本滚动在iDevices上不兼容
- three.js javascript/raycasting代码与retina显示器Mac不兼容
- TypeScript无效的重载签名-与实现不兼容
- PHP JSON编码输出与Javascript Ajax不兼容
- ACE编辑器applyDeltas似乎与setTimeout不兼容
- Element.insertAdjacentHTML与引导程序类之前和之后的::不兼容
- Geocoding和Animation.drop与超时不兼容
- 如何让我的html5功能不兼容警告使用javascript工作
- 不兼容的数据表: 错误:表包含的列数超过预期
- HTML5 不兼容的浏览器测试
- 有什么方法可以将类型指定为 self?或解决方法“属性类型不兼容”
- React 15 与 React-redux 不兼容
- Strava-V3 和 Javascript es6 生成器 = 不兼容