Flickity 幻灯片之间的淡入淡出
将flickity-fade.css
添加到样式表中, flickity-fade.js
到脚本中。
<!-- CSS -->
< link rel =" stylesheet " href =" https://unpkg.com/flickity-fade@2/flickity-fade.css " >
<!-- JS -->
< script src =" https://unpkg.com/flickity-fade@2/flickity-fade.js " > </ script >
npm install flickity-fade
yarn add flickity-fade
通过在 Flickity 选项中设置fade: true
来启用淡入淡出行为。
// jQuery
let $carousel = $ ( '.carousel' ) . flickity ( {
fade : true ,
} ) ;
// vanilla JS
let flkty = new Flickity ( '.carousel' , {
fade : true ,
} ) ;
<!-- HTML -->
< div class =" carousel " data-flickity =' { "fade": true } ' >
...
</ div >
const Flickity = require ( 'flickity' ) ;
require ( 'flickity-fade' ) ;
let flkty = new Flickity ( '.carousel' , {
fade : true ,
} ) ;
这个功能在功能请求炼狱中度过了四年。永不放弃。
通过Metafizzy?