css - 使用 css 转换 :scale? 时如何删除闪烁线

标签 css css-animations flicker

当鼠标悬停在图像上时,我一直在尝试消除这种丑陋的闪烁。我尝试将 -webkit-backface-visibility: hidden; 添加到悬停元素以及 :hover 本身,但似乎无法动摇它。似乎问题只出现在 Chrome 和 Safari 上。 网址:http://best-law-firm-sites.com/lawpromo12/

.col-sm-4 {
    width: 33.3333%;
    float: left;
}
.panel-wrap {
    height: 100% !important;
}
.panel-wrap .col-sm-4 {
    padding: 0;
}
.hovereffect {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
    cursor: default;
}
.hovereffect .overlay {
    width: 100%;
    height: 100%;
    position: absolute;
    overflow: hidden;
    top: 0;
    left: 0;
    -webkit-transition: all 0.4s ease-in-out;
    -moz-transition: all 0.4s ease-in-out;
    -o-transition: all 0.4s ease-in-out;
    transition: all 0.4s ease-in-out;
}
.hovereffect h2,
.hovereffect img {
    -webkit-transition: all 0.5s ease-in-out;
    -moz-transition: all 0.5s ease-in-out;
    -o-transition: all 0.5s ease-in-out;
    transition: all 0.5s ease-in-out;
}
.hovereffect img {
    display: block;
    position: relative;
    -webkit-transform:  scale(1.001);
    -ms-transform:  scale(1.001);
    -moz-transform:  scale(1.001);
    -o-transform:  scale(1.001);
    transform:  scale(1.001);
}
.hovereffect:hover img {
    -webkit-transform: scale(1.17);
    -ms-transform: scale(1.17);
    -moz-transform: scale(1.17);
    -o-transform: scale(1.17);
    transform: scale(1.17);
}
.hovereffect h2 {
    bottom: 10%;
    color: #fff;
    font-size: 30px;
    font-weight: 700;
    padding: 10px 10px 10px 17px;
    position: absolute;
    text-align: left;
    text-shadow: 2px 3px 6px rgba(0, 0, 0, 1);
    text-transform: uppercase;
}
.hovereffect h2::after {
    display: block;
    content: "";
    height: 4px;
    width: 75px;
    background: #BCA474;
    margin: 20px 0 0;
    box-shadow: 2px 3px 6px rgba(0, 0, 0, 0.6);
}
.hovereffect a.info {
    display: inline-block;
    text-decoration: none;
    padding: 7px 14px;
    text-transform: uppercase;
    color: #fff;
    margin: 50px 0 0 0;
    background-color: transparent;
    -webkit-transform: scale(1.5);
    -ms-transform: scale(1.5);
    transform: scale(1.5);
    -webkit-transition: all 0.4s ease-in-out;
    transition: all 0.4s ease-in-out;
    font-weight: normal;
    height: 100%;
    width: 85%;
    position: absolute;
    top: 0;
    left: 0;
    padding: 70px;
}
.hovereffect:hover a.info {
    -webkit-transform: scale(1);
    -ms-transform: scale(1);
    transform: scale(1);
}
<div class="col-sm-4 panel-1">   
<div class="hovereffect">
        <img class="img-responsive" src="http://best-law-firm-sites.com/lawpromo12/wp-content/uploads/2016/02/panel1.jpg" alt="">
        <div class="overlay">
           <h2>Family Law</h2>
           <a class="info" href="services/family-law/"></a>
        </div>
    </div>
  </div>

  <div class="col-sm-4 panel-2">   
<div class="hovereffect">
        <img class="img-responsive" src="http://best-law-firm-sites.com/lawpromo12/wp-content/uploads/2016/02/panel.jpg" alt="">
        <div class="overlay">
           <h2>Estate Planning</h2>
           <a class="info" href="services/estate-planning/"></a>
        </div>
    </div>
  </div>

  <div class="col-sm-4 panel-2">   
<div class="hovereffect">
        <img class="img-responsive" src="http://best-law-firm-sites.com/lawpromo12/wp-content/uploads/2016/02/panel.jpg" alt="">
        <div class="overlay">
           <h2>Wills & Trusts</h2>
           <a class="info" href="services/wills-trusts/"></a>
        </div>
    </div>
  </div>

最佳答案

我在过去使用背面可见性 hack 来欺骗浏览器使用 3d 管道时遇到过类似的奇怪行为。还有其他方法可以“欺骗”浏览器使用 3d 管道,例如:

.class{
    transform: translate3d(0,0,1);
}

关于css - 使用 css 转换 :scale? 时如何删除闪烁线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35566633/

相关文章:

jquery - Bootstrap-3 : Input Group-Addon STRETCHES with jQuery Validation messages

html - 使用css动画让div元素移动到页面的每个 Angular 落

html - 基于关键帧的动画

jquery - scrolltofixed 限制问题和闪烁

wpf - 在 WPF 中更新 ObservableCollection 会导致屏幕闪烁;我该如何预防?

css - 边距的奇怪 CSS 问题

html - css概念中div在div中垂直居中

css - 如何循环一组动画,即每行在 css 动画中跳动一次?

java - 如何消除java动画闪烁

javascript - 为什么在内容容器外单击时灯箱不关闭