我目前使用下面使用jQuery和悬停功能,当用户悬停在图像中的褪色的“标题”元素下面的代码。 与移动触摸设备如iPad的需要用户来挖掘图像触发悬停功能的字幕淡入如预期,但直到用户选择页面上的其他对象保持活动状态进行测试时,它这工作完全在桌面浏览器,但是。
我想知道一个简单的方法来修改我的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>
任何想法,想法将是非常赞赏。
克里斯