【发布时间】:2014-06-02 04:19:23
【问题描述】:
我正在尝试使用 CSS 转换组合一个“翻页”动画。我有一个在页面上垂直运行的长条(div)。当我想要关闭页面使其不可见时,我添加了 stripe_animation_closed 样式(并删除了打开样式)。当我想打开一个页面时,我添加了 stripe_animation_exec_left_open 样式(并删除了 close 样式)。我正在转动的 DIV 有一个 UL,其中包含一些包含文本的 LI 元素。
发生的情况是,有时 FireFox 会在其中一个动画发生时崩溃。我一生都无法弄清楚发生了什么。我用谷歌搜索了这个,看到一些关于字体不好的 Firefox 错误,但我使用的是他们建议的 Arial。
奇怪的是,我在隐藏页面和打开新页面之间有 2 秒的 setTimeout。如果我只是忘记了超时并将所有样式一起添加/删除,则似乎不会发生崩溃。它也没有动画。
进行样式切换的代码
$(".stripe_4 .fSort li").on("click", function() {
if( $(".stripe_3").hasClass("stripe_animation_exec_left_open") ){
$(".stripe_3").removeClass("stripe_animation_exec_left_open");
$(".stripe_3").addClass("stripe_animation_closed");
setTimeout( function(){
$(".stripe_3").addClass("stripe_animation_closed");
$(".stripe_3").addClass("stripe_animation_exec_left_open");
}, 2000 );
} else {
$(".stripe_3").addClass("stripe_animation_closed");
$(".stripe_3").addClass("stripe_animation_exec_left_open");
}
$(".stripe_4 .fSelected").removeClass("fSelected");
$(this).addClass("fSelected");
//attemptJoin();
});
关闭页面的样式
.stripe_animation_closed {
-webkit-transition: all 1s ease-in-out;
-moz-transition: all 1s ease-in-out;
-o-transition: all 1s ease-in-out;
transition: all 1s ease-in-out;
-webkit-transform: rotateY(90deg) ;/*scale(0.97, 0.97);*/
-moz-transform: rotateY(90deg) ;/*scale(0.97, 0.97);*/
-o-transform: rotateY(90deg) ;/*scale(0.97, 0.97);*/
-ms-transform: rotateY(90deg) ;/*scale(0.97, 0.97);*/
transform: rotateY(90deg) ;/*scale(0.97, 0.97);*/
/*transform-origin: 0%;*/
opacity:0.1;
}
打开页面的样式
.stripe_animation_exec_left_open {
-webkit-transition: all 1s ease-in-out;
-moz-transition: all 1s ease-in-out;
-o-transition: all 1s ease-in-out;
transition: all 1s ease-in-out;
-webkit-transform: rotateY(0deg); /*scale(1, 1);*/
-moz-transform: rotateY(0deg); /*scale(1, 1);*/
-ms-transform: rotateY(0deg); /*scale(1, 1);*/
-o-transform: rotateY(0deg); /*scale(1, 1);*/
transform: rotateY(0deg); /*scale(1, 1);*/
/*transform-origin: 0%;*/
opacity: 1;
}
【问题讨论】:
-
您能否发布来自
about:crashes的崩溃链接?它可能会提供一些提示。 -
这指向bugzilla.mozilla.org/show_bug.cgi?id=805406,这看起来像是 Windows 上的驱动程序问题。从您的角度来看,我想说的是,您在 CSS 中并没有做错任何事情。我在错误中链接了这个问题。
-
我更新了我的 NVidia 显示驱动程序,这似乎解决了问题。谢谢@silverwind。
标签: css firefox animation css-transforms