简体   繁体   English

淡出iPad上的悬停效果

[英]Fadeout on hover effect in iPad

I tried to use the fadeIn and fadeOut effect as you can see in this page: http://www.lifetime-watches.com/gal-w.html 如您在此页面中所见,我尝试使用了淡入和淡出效果: http : //www.lifetime-watches.com/gal-w.html

var titleString = $(this).find('a').attr("title");
$("#title").html(titleString).fadeIn(100);
;

So when they run the script the title of the image would fade in in a div. 因此,当他们运行脚本时,图像的标题会在div中淡入。

But the problem is when this page is opened in iPads, the hover function doesn't work (because obviously they don't have hover) and the div wouldn't fade out. 但是问题是,在iPad上打开此页面时,悬停功能不起作用(因为显然他们没有悬停),并且div不会消失。

What are the alternatives to this? 有哪些替代方案? Any help is appreciated. 任何帮助表示赞赏。 Thank you. 谢谢。

The jQuery Hoverable Plugin : jQuery Hoverable插件

unifies touch and mouse events over different platforms like desktops and mobile devices with touchscreens 通过触摸屏在台式机和移动设备等不同平台上统一触摸和鼠标事件

That might be a good alternative for your app. 对于您的应用程序,这可能是一个不错的选择。

You want to create a second implementation that works with the click event. 您要创建与click事件一起使用的第二个实现。 May be something like this: 可能是这样的:

$(selector syntax).click(function () { AnimationEffect(this); });
$(selector syntax).mouseenter(function () { AnimationEffect(this); });

function AnimationEffect(TheDiv) {
//your animation goes here, TheDiv is the jquery object
//you can access it like this: $(TheDiv).
}

Have the user click on the watch, then click again to get rid of the info. 让用户单击手表,然后再次单击以删除信息。

This can be accomplished using the .toggle() method: http://api.jquery.com/toggle-event/ 这可以使用.toggle()方法完成: http ://api.jquery.com/toggle-event/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM