2
我试图对图像进行简单的悬停效果。它在桌面上运行良好,但在iPad上有问题。当我尝试点击右侧图像时,此图像的右侧不会影响点击,叠加层不显示。但左侧图像和右侧图像的左侧显示重叠在点击罚款。也许有人可以解释这种奇怪的行为?在iPad上点按/悬停有时候不起作用
HTML:
<div class="col-sm-6 team-wrap">
<div class="team-member text-center">
<div class="team-img">
<img src="" alt="">
<div class="overlay"></div>
</div>
<h4 class="team-title">David Geller</h4>
<span>CEO of Company</span>
</div>
</div>
<div class="col-sm-6 team-wrap">
<div class="team-member text-center">
<div class="team-img">
<img src="" alt="">
<div class="overlay"></div>
</div>
<h4 class="team-title">David Geller</h4>
<span>CEO of Company</span>
</div>
</div>
的CSS:
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.col-sm-6 {
width: 50%;
float: left;
position: relative;
min-height: 1px;
padding-left: 15px;
padding-right: 15px;
}
.team-img img {
-webkit-transition: all .2s ease-in-out;
-moz-transition: all .2s ease-in-out;
-o-transition: all .2s ease-in-out;
transition: all .2s ease-in-out;
overflow: hidden;
width: 100%;
}
.team-member,
.team-img {
position: relative;
overflow: hidden;
}
.team-title {
margin: 34px 0 8px;
}
.overlay {
background-color: rgba(20,20,20,.7);
position: absolute;
top: 0;
width: 100%;
height: 100%;
opacity: 0;
-webkit-transition: all .2s ease-in-out;
-moz-transition: all .2s ease-in-out;
-o-transition: all .2s ease-in-out;
transition: all .2s ease-in-out;
overflow: hidden;
}
.team-img:hover .overlay {
opacity: 1;
}
Codepen链接:
http://codepen.io/anon/pen/ZQOKGG
是我也想过这个,但为什么在其他网站上它工作正常?例如这一个 - http://psd2html5.in/demo/wpm/auril/它有“最新作品”相同的样式,一切正常。 – Alexander
嗯,我看,它的作用就像一个悬停效果,在一台电脑上,你可以悬停在一个按钮上,而不需要点击,但是在你不能悬停的Ipad上,你可以立即点击它。猜猜这是问题所在。 –
奥克我猜这是一个国外的答案,你可以试试,如果它在iPad上按住几秒钟的按钮时有效? –