如何将自定义效果添加到 Swiper 滑块 JavaScript 库?
How to add custom effects to the Swiper slider JavaScript library?
我想向 Swiper 滑块 JavaScript 库添加新的自定义效果。
默认的 Swiper 效果是 slide
、fade
、cube
、coverflow
或 flip
但我想在所有事件中添加我的自定义效果。我该怎么做?
转到 swiper.js
中的 s.effects
对象(效果部分)并添加您自己的效果 属性,如下所示:
myEffect: {
setTranslate: function() {
// your actual animation code goes here
},
setTransition: function( duration ) {
// duration is between 0 and max speed (300 is default)
// but you can change it in the config object below
// is called when your swiping starts and ends
}
}
要使用您的新效果,请执行以下操作:
var mySwiper = new Swiper( '.swiper-container', {
// other options …
// and add this
effect: “myEffect”
}
);
有关更多信息,请查看此处:
https://github.com/nolimits4web/Swiper/issues/1497
我想向 Swiper 滑块 JavaScript 库添加新的自定义效果。
默认的 Swiper 效果是 slide
、fade
、cube
、coverflow
或 flip
但我想在所有事件中添加我的自定义效果。我该怎么做?
转到
swiper.js
中的s.effects
对象(效果部分)并添加您自己的效果 属性,如下所示:myEffect: { setTranslate: function() { // your actual animation code goes here }, setTransition: function( duration ) { // duration is between 0 and max speed (300 is default) // but you can change it in the config object below // is called when your swiping starts and ends } }
要使用您的新效果,请执行以下操作:
var mySwiper = new Swiper( '.swiper-container', { // other options … // and add this effect: “myEffect” } );
有关更多信息,请查看此处: https://github.com/nolimits4web/Swiper/issues/1497