了
解
紅
點(diǎn)
最
新
動(dòng)
態(tài)
和
行
業(yè)
資
訊
附件:http://www.lvpaiqingdao.com/upfile/2019/01/20190111133507_432.rar
在一些網(wǎng)頁上,當(dāng)你滾動(dòng)頁面的時(shí)候會(huì)看到各式各樣的元素動(dòng)畫效果,非常動(dòng)感。WOW.js 就是一款幫助你實(shí)現(xiàn)這種 CSS 動(dòng)畫效果的插件,很容易定制,你可以改變動(dòng)畫設(shè)置喜歡的風(fēng)格、延遲、長(zhǎng)度、偏移和迭代等。
1、引入文件
1 | < link rel = "stylesheet" href = "css/animate.min.css" > |
2、HTML
1 2 | < div class = "wow slideInLeft" ></ div > < div class = "wow slideInRight" ></ div > |
可以加入 data-wow-duration(動(dòng)畫持續(xù)時(shí)間)和 data-wow-delay(動(dòng)畫延遲時(shí)間)屬性,如:
1 2 | < div class = "wow slideInLeft" data-wow-duration = "2s" data-wow-delay = "5s" ></ div > < div class = "wow slideInRight" data-wow-offset = "10" data-wow-iteration = "10" ></ div > |
3、JavaScript
1 | new WOW().init(); |
如果需要自定義配置,可如下使用:
1 2 3 4 5 6 7 8 | var wow = new WOW({ boxClass: 'wow' , animateClass: 'animated' , offset: 0, mobile: true , live: true }); wow.init(); |
配置
屬性/方法 | 類型 | 默認(rèn)值 | 說明 |
boxClass | 字符串 | ‘wow’ | ‘wow’ 需要執(zhí)行動(dòng)畫的元素的 class |
animateClass | 字符串 | ‘a(chǎn)nimated’ | ‘a(chǎn)nimated’animation.css 動(dòng)畫的 class |
offset | 整數(shù) | 0 | 距離可視區(qū)域多少開始執(zhí)行動(dòng)畫 |
mobile | 布爾值 | true | 是否在移動(dòng)設(shè)備上執(zhí)行動(dòng)畫 |
live | 布爾值 | true | 異步加載的內(nèi)容是否有效 |