我有以下代码
<div>
<img src="http://placehold.it/350x150"/>
<div class="link-cont"><a href="#">click here to see more info</a></div>
</div>
div {
width: 350px;
font-size:12px;
position: relative;
}
div img{
padding:0 10px;
}
.link-cont {
background: red;
position: absolute;
bottom: 0;
width: 370px;
height: 210px;
opacity: 0;
transition: all 0.4s;
z-index: -1
}
div:hover .link-cont {
opacity: 1;
bottom:-40px;
}
.link-cont a{
opacity: 0;
}
div:hover .link-cont a{
position: relative;
opacity: 1;
bottom:-175px;
left:10px;
background:#fff;
color:red;
text-decoration:none;
padding:0 10px;
}
链接包含在悬停时出现的div内。我如何使这个触摸设备友好。
jsfidd - &GT; http://jsfiddle.net/yeyene/Nnd7w/17/
答案 0 :(得分:5)
几种解决方案:
答案 1 :(得分:-2)
试试这个:
<script>
document.addEventListener("touchstart", function(){}, true);
</script>