边缘浏览器:仅当同时使用倾斜和平移时,过渡结束时才会出现抖动
Edge browser: Jerking movement at the end of transition only when skew and translate are used together
我的锚标签后面有一个 position:absolute 元素。当锚标记悬停时,我使用简单的 css 转换为该元素设置动画。
仅在 Edge 上,在过渡的最后会有这种时髦的抖动。
我尝试将 translateX(0) 添加到悬停和正常状态,但这并没有消除最后的抖动。
这是按钮 html:
.button {
display: inline-block;
border: none;
background: transparent;
position: relative;
color: #212121;
font-size: 19px;
line-height: 1;
padding: 0;
margin: 30px;
text-decoration: none;
font-weight: 400;
cursor: pointer;
z-index: 2;
transition: .3s;
transition-timing-function: cubic-bezier(.82, .21, .27, .81);
}
.button-bg {
position: absolute;
padding: 30px;
height: 50px;
border-radius: 0;
left: -30px;
right: -30px;
top: 50%;
transform: translateY(-50%);
z-index: -1;
transition: .4s;
transition-timing-function: cubic-bezier(.82, .21, .27, .81);
transform-origin: center;
border: 2px solid #212121;
}
a.button:hover .button-bg {
-webkit-transform: translateY(-50%) scaleY(2) scaleX(1.4) skewY(10deg);
transform: translateY(-50%) scaleY(2) scaleX(1.4) skewY(10deg);
-webkit-transform-origin: center;
transform-origin: center;
border: 2px solid transparent;
-webkit-box-shadow: 0px 0px 20px 0px rgba(48, 48, 48, 0.6);
-moz-box-shadow: 0px 0px 20px 0px rgba(48, 48, 48, 0.6);
box-shadow: 0px 0px 20px 0px rgba(48, 48, 48, 0.6);
}
<a class="button case-readmore" href="#">
Read Case
<span class="button-bg"></span>
</a>
使用Chrome、Firefox、Internet explorer 等
可以看到预期结果
在 Edge 中可以看到奇怪的 bugfest,其中元素正确地变换并且在变换的最后快速向右猛拉。
如果我删除过渡的偏斜部分,就不会再有抖动了。
尝试在悬停前添加默认值。可能存在插值问题。
.button {
display: inline-block;
border: none;
background: transparent;
position: relative;
color: #212121;
font-size: 19px;
line-height: 1;
padding: 0;
margin: 30px;
text-decoration: none;
font-weight: 400;
cursor: pointer;
z-index: 2;
transition: .3s;
transition-timing-function: cubic-bezier(.82, .21, .27, .81);
}
.button-bg {
position: absolute;
padding: 30px;
height: 50px;
border-radius: 0;
left: -30px;
right: -30px;
top: 50%;
transform: translateY(-50%) scaleY(1) scaleX(1) skewY(0deg);
z-index: -1;
transition: .4s;
transition-timing-function: cubic-bezier(.82, .21, .27, .81);
transform-origin: center;
border: 2px solid #212121;
}
a.button:hover .button-bg {
transform: translateY(-50%) scaleY(2) scaleX(1.4) skewY(10deg);
transform-origin: center;
border: 2px solid transparent;
box-shadow: 0px 0px 20px 0px rgba(48, 48, 48, 0.6);
}
<a class="button case-readmore" href="#">
Read Case
<span class="button-bg"></span>
</a>
相关:
我的锚标签后面有一个 position:absolute 元素。当锚标记悬停时,我使用简单的 css 转换为该元素设置动画。
仅在 Edge 上,在过渡的最后会有这种时髦的抖动。
我尝试将 translateX(0) 添加到悬停和正常状态,但这并没有消除最后的抖动。
这是按钮 html:
.button {
display: inline-block;
border: none;
background: transparent;
position: relative;
color: #212121;
font-size: 19px;
line-height: 1;
padding: 0;
margin: 30px;
text-decoration: none;
font-weight: 400;
cursor: pointer;
z-index: 2;
transition: .3s;
transition-timing-function: cubic-bezier(.82, .21, .27, .81);
}
.button-bg {
position: absolute;
padding: 30px;
height: 50px;
border-radius: 0;
left: -30px;
right: -30px;
top: 50%;
transform: translateY(-50%);
z-index: -1;
transition: .4s;
transition-timing-function: cubic-bezier(.82, .21, .27, .81);
transform-origin: center;
border: 2px solid #212121;
}
a.button:hover .button-bg {
-webkit-transform: translateY(-50%) scaleY(2) scaleX(1.4) skewY(10deg);
transform: translateY(-50%) scaleY(2) scaleX(1.4) skewY(10deg);
-webkit-transform-origin: center;
transform-origin: center;
border: 2px solid transparent;
-webkit-box-shadow: 0px 0px 20px 0px rgba(48, 48, 48, 0.6);
-moz-box-shadow: 0px 0px 20px 0px rgba(48, 48, 48, 0.6);
box-shadow: 0px 0px 20px 0px rgba(48, 48, 48, 0.6);
}
<a class="button case-readmore" href="#">
Read Case
<span class="button-bg"></span>
</a>
使用Chrome、Firefox、Internet explorer 等
可以看到预期结果在 Edge 中可以看到奇怪的 bugfest,其中元素正确地变换并且在变换的最后快速向右猛拉。
如果我删除过渡的偏斜部分,就不会再有抖动了。
尝试在悬停前添加默认值。可能存在插值问题。
.button {
display: inline-block;
border: none;
background: transparent;
position: relative;
color: #212121;
font-size: 19px;
line-height: 1;
padding: 0;
margin: 30px;
text-decoration: none;
font-weight: 400;
cursor: pointer;
z-index: 2;
transition: .3s;
transition-timing-function: cubic-bezier(.82, .21, .27, .81);
}
.button-bg {
position: absolute;
padding: 30px;
height: 50px;
border-radius: 0;
left: -30px;
right: -30px;
top: 50%;
transform: translateY(-50%) scaleY(1) scaleX(1) skewY(0deg);
z-index: -1;
transition: .4s;
transition-timing-function: cubic-bezier(.82, .21, .27, .81);
transform-origin: center;
border: 2px solid #212121;
}
a.button:hover .button-bg {
transform: translateY(-50%) scaleY(2) scaleX(1.4) skewY(10deg);
transform-origin: center;
border: 2px solid transparent;
box-shadow: 0px 0px 20px 0px rgba(48, 48, 48, 0.6);
}
<a class="button case-readmore" href="#">
Read Case
<span class="button-bg"></span>
</a>
相关: