gpt4 book ai didi

html - 在 firefox 上播放动画时文本闪烁

转载 作者:太空宇宙 更新时间:2023-11-04 11:28:49 26 4
gpt4 key购买 nike

我想使用 CSS 和 Angular Js 制作幻灯片动画。我是这样的:JSFiddle在 chrome 上,此动画效果完美。但是在 Firefox 上,当动画继续播放时,文本会稍微抖动和闪烁。我无法找出确切的问题。任何想法..

代码:

HTML:

<div ng-controller="animationCtrl">
<ul class='list'>
<li>
<div class="slide-animation">
<div class="slide-animation-wrap new-slide-wrap {{cssTimeInfo1}}"> <span class="text">{{valueSet1[0]}}</span>

<label class="small-label">{{valueSet2[1]}}</label>
</div>
<div class="slide-animation-wrap old-slide-wrap {{cssTimeInfo1}}"> <span class="text">{{valueSet1[1]}}</span>

<label class="small-label">{{valueSet2[1]}}</label>
</div>
</div>
</li>
</ul>
</div>

CSS:

.list > li {
box-sizing:border-box;
height: 72px;
display: inline-block;
margin-right: 1.06%;
padding: 15px;
vertical-align: top;
background-color: #f1f1f1;
-webkit-box-shadow: 0 0 7px rgba(210, 210, 210, 0.3) inset;
box-shadow: 0 0 7px rgba(210, 210, 210, 0.3) inset;
}

.small-label {
height: 24px;
display: block;
font-size: 0.714em;
margin-bottom: 0;
color: #999999;
text-transform: uppercase;
text-align: center;
}
.text {
height: 24px;
display: block;
font-size: 1.286em;
margin-bottom: 3px;
color: #666666;
text-align: center;
}



/* Slide animation */
.slide-animation {
overflow: hidden;
position: relative;
height: 40px;
}
.slide-animation-wrap {
position: relative;
width: 100%;
}
.slide-animation-wrap.new-slide-wrap {
top: -45px;
}
.slide-animation-wrap.old-slide-wrap {
top: -51px;
}
.slide-animation-wrap.slide-in-animation,
.slide-animation-wrap.slide-out-animation {
-webkit-animation: slide-outside-animation 1s linear forwards;
-o-animation: slide-outside-animation 1s linear forwards;
animation: slide-outside-animation 1s linear forwards;
}
.slide-animation-wrap:before,
.slide-animation-wrap:after {
content: " ";
display: table;
}
.slide-animation-wrap:after {
clear: both;
}
.slide-animation-wrap:before,
.slide-animation-wrap:after {
content: " ";
display: table;
}
.slide-animation-wrap:after {
clear: both;
}
@-webkit-keyframes slide-outside-animation {
0% {
-webkit-transform: translateY(0px);
-ms-transform: translateY(0px);
transform: translateY(0px);
}
100% {
-webkit-transform: translateY(45px);
-ms-transform: translateY(45px);
transform: translateY(45px);
}
}
@-moz-keyframes slide-outside-animation {
0% {
-webkit-transform: translateY(0px);
-ms-transform: translateY(0px);
transform: translateY(0px);
}
100% {
-webkit-transform: translateY(45px);
-ms-transform: translateY(45px);
transform: translateY(45px);
}
}
@-ms-keyframes slide-outside-animation {
0% {
-webkit-transform: translateY(0px);
-ms-transform: translateY(0px);
transform: translateY(0px);
}
100% {
-webkit-transform: translateY(45px);
-ms-transform: translateY(45px);
transform: translateY(45px);
}
}
@keyframes slide-outside-animation {
0% {
-webkit-transform: translateY(0px);
-ms-transform: translateY(0px);
transform: translateY(0px);
}
100% {
-webkit-transform: translateY(45px);
-ms-transform: translateY(45px);
transform: translateY(45px);
}
}

Angular :

var myApp = angular.module('myApp',[]);
myApp.controller('animationCtrl', ['$scope','$interval', function ($scope,$interval) {
$scope.valueSet1=['HGFhgfsffghfhgf','HGFhgfsffghfhgf'];
$scope.valueSet2=['ABC','ABC'];
$scope.cssTimeInfo1 = "display-none";
$scope.cssTimeInfo2 = "display-none";
var flag=0;
$interval(function(){
//0
$scope.cssTimeInfo1='slide-in-animation';
$scope.cssTimeInfo2 = "display-none";
flag++;
if(flag>1){
flag=0;
//0

$scope.cssTimeInfo1 = " ";
$scope.cssTimeInfo2 = " ";

}
else{
//1

$scope.cssTimeInfo1 = "slide-out-animation";
$scope.cssTimeInfo2 = "slide-in-animation";
}
},1000);

}]);

最佳答案

我在使用转换的 Firefox 上遇到了文本闪烁问题。添加

背面可见性:隐藏;

转换后的元素为我解决了这个问题。

关于html - 在 firefox 上播放动画时文本闪烁,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32179300/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com