cannot repeat animation - jQuery

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-12 03:45:16

问题


I can't repeat animation with the following example (using jQuery Transit)

$("#rotateDiv2").button().click(function() {
    $('#second').transition({
        perspective: '100px',
        easing: 'snap',
        duration: '3000ms',
        rotate3d: '1, 1, 0, 360deg'
    });
});

It does work, only it work once (when clicking the button of course). the second time i click its doing nothing. Thanx!!


回答1:


You can reset the CSS transform property in the callback:

http://jsfiddle.net/zA2ZQ/2/

$("#rotateDiv2").button().click(function() {
    $('#second').transition({
        perspective: '100px',
        easing: 'snap',
        duration: '3000ms',
        rotate3d: '1, 1, 0, 360deg'
    }, function(){
      //reset the transform property
      $(this).css('transform', '');
    });
});​


来源:https://stackoverflow.com/questions/11579287/cannot-repeat-animation-jquery

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!