js 溫故而知新 webkitTransitionEnd 監聽Transition動畫結束事件


css3的過渡屬性transition,在動畫結束時,也存在結束的事件:webkitTransitionEnd; 

注意:transition,也僅僅有這一個事件。

 

http://www.runoob.com/jsref/event-transitionend.html

 

vuejs代碼片段:

 setTimeout(() => {
        this.wrap.classList.add('swipe-transition');
        this.swipeMove(-this.index * this.pageWidth);

        once(this.wrap, 'webkitTransitionEnd', _ => {
          this.wrap.classList.remove('swipe-transition');
          // 李釗鴻注釋的代碼
          // this.wrap.style.webkitTransform = '';
          this.swiping = false;
          this.index = null;
           // 李釗鴻加入的代碼:
          this.$store.dispatch('set_translateX','0')
        });
}, 0);

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM