webkit translateX animation is rolling back to initial position

后端 未结 4 698
轻奢々
轻奢々 2021-02-05 13:08

I am trying to do a images gallery for mobile webkit,

The only way it is actually fast enough is using the hardware accelerated translateX .

My problem is that

4条回答
  •  佛祖请我去吃肉
    2021-02-05 13:56

    I was able to make it work by adding a "display:none" style on the finish of the animation. Use the following CSS:

    .paused {
        -webkit-animation-play-state: paused;
    }
    
    .hiddendiv {
        display:none;
    }
    

    Then in your jQuery code:

    $('div.sideimage').click(
        function () {
            $(this).removeClass("paused").delay(2000).queue(
                function(next) {     
                    $(this).addClass("hiddendiv");     
                    next();
                }
            ); 
        }
    );
    

    Should work!

提交回复
热议问题