简体   繁体   English

CSS过渡在Firefox上不起作用

[英]CSS transition not working on Firefox

I have a div #im1 with initial position left:-300px; 我有一个div#im1,初始位置为左:-300px; When a button .abtme_link is clicked the javaScript changes it's position to 443px; 单击按钮.abtme_link时 ,javaScript会将其位置更改为443px。 It's working on every other browser than Firefox; 它可以在除Firefox之外的所有其他浏览器上运行; I've seen some other posts on this matter but can't seem to make it work; 我已经看过其他有关此问题的文章,但似乎无法使它起作用。 One of the thread concluded that css transition doesn't work on Firefox, If that's the case; 其中一个线程得出结论,css转换在Firefox上不起作用,如果是这种情况; is there a workaround? 有解决方法吗?

#im1{
    width:400px;
    position:absolute;
    left:-300px;
    transition:all .9s ease .5s;
    -webkit-transition:all .9s ease .5s;
    -moz-transition:all .9s ease .5s;
    -o-transition:all .9s ease .5s;
    -ms-transition:all .9s ease .5s;
}

$('.abtme_link').click(function() {
        $('#im1').css('left','443px');
    });

OK so I've found a solution, 好,我找到了解决方案,

I've added a delay function in JS and it's working fine. 我在JS中添加了一个延迟功能,并且工作正常。 Don't know why or how but it's working. 不知道为什么或如何,但它正在工作。

setTimeout(function(){
            $('.im1').css('left','443px');
        },10);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM