大佬教程收集整理的这篇文章主要介绍了jQuery悬停功能超时,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我想知道一种简单的方法来修改我的javascript代码以检测移动触摸设备,然后将一些排序或计时器放到标题中,以便它在一段时间后自动消失?
<!-- include jQuery library --> <script type="text/javascript" src="./_js/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function() { //On mouse over those thumbnail $('.item-caption').hover(function() { //Display the caption $(this).find('.caption').stop(false,true).fadeIn(200); },function() { //Hide the caption $(this).find('.caption').stop(false,true).fadeOut(600); }); }); </script> </head> <body> <div class="item-caption"><a href="http://www.domain.com"> <div class="caption"> <ul> <li><h2>TITLE</h2></li> <li><h3>Description</h3></li> </ul> </div> <img src="./_img/example_image.jpg"></a> </div> </body>
任何想法,想法都会受到最高的赞赏.
克里斯
$(document).ready(function() { function hasTouch() { try { document.createEvent("TouchEvent"); return(true); } catch (e) { return(false); } } var touchPresent = hasTouch(); //On mouse over those thumbnail $('.item-caption').hover(function() { //Display the caption var caption = $(this).find('.caption'); caption.stop(true,true).fadeIn(200); // on touch systems,fade out after a time delay if (touchPresent) { caption.delay(5000).fadeOut(600); } },function() { //Hide the caption $(this).find('.caption').stop(true,true).fadeOut(600); }); });
以上是大佬教程为你收集整理的jQuery悬停功能超时全部内容,希望文章能够帮你解决jQuery悬停功能超时所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。