我遇到了一个在网站上实现悬停效果的问题。这种效果在桌面上效果很好。在移动设备上,图像都显示正常,当我点击时,它们会将我带到正确的链接。但当我向后按浏览器时,我看到的只是图片和文本。有人能给点建议吗?这是我目前拥有的代码。对于类似的问题,我似乎找不到任何解决方案。谢谢
$(document).ready(function () {
$('.img1')
.mouseover(function () {
$(this).attr("src", "https://cdn.shopify.com/s/files/1/1297/5789/t/3/assets/Easy_Motion_-_Electric_Bicycles_Two.jpg?6314974642385151026");
})
.mouseout(function () {
$(this).attr("src", "https://cdn.shopify.com/s/files/1/1297/5789/t/3/assets/Easy_Motion_-Electric_Bikes.jpg?10135819641956685452");
});
<div class='desktop-4 tablet-full mobile-full'><a href='/home'><img src="https://cdn.shopify.com/s/files/1/1297/5789/t/3/assets/Easy_Motion_-Electric_Bikes.jpg?10135819641956685452" alt="electric bikes by easy motion" class="img1"/></a></div>发布于 2016-11-30 01:20:18
只需在移动设备上禁用它(鼠标输入ecc..不起作用)
$(document).ready(function() {
if(!isMobile) {
// your code...
}
});检查这个问题:What is the best way to detect a mobile device in jQuery?用于检测移动设备或使用现代来检测是否启用了触摸
https://stackoverflow.com/questions/40871791
复制相似问题