jQuery – plugin – period – 批次讓元素間隔時間執行

jquery.period.js

如果想要「將指定的元素集合,批次間隔固定時間去做一些事情」那麼可以用這支非常簡單的 plugin。

安裝

前往 Github 下載 或是使用 npm 下載

npm i jquery.period.js

載入方式

import 'jquery.period.js'

 

範例

這個範例是讓所有的 .item 間距 200 毫秒,批次動畫的增加高度。

$(".item").period({
    delayTimes: 200,
    before: function (){
        // ...
    },
    todo: function(index){
        // ...
    },
    after: function (){
        // ...
    }
})

我們看實際範例: