如何在使用css tranform时删除闪烁线:scale?

时间:2016-02-23 00:29:52

标签: css css3 css-animations flicker

当我将鼠标悬停在图像上时,我一直试图消除这种丑陋的闪烁。我尝试将-webkit-backface-visibility: hidden;添加到悬停元素以及:悬停本身,但似乎无法动摇它。似乎promblem仅适用于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>

2 个答案:

答案 0 :(得分:0)

过去使用背面可见性黑客欺骗浏览器使用3d管道时,我遇到过类似的奇怪行为。还有其他方法来欺骗&#39;浏览器使用3d管道如:

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

答案 1 :(得分:0)

您可以通过将transform比例属性增加到1.001:

来解决此问题
.hovereffect img{transform: scale(1.001);}