admin管理员组文章数量:1336437
I want to add a new custom effect to the Swiper slider JavaScript library.
The default Swiper effects are slide
, fade
, cube
, coverflow
or flip
but I want to add my custom effect with and all events. How can I do that?
I want to add a new custom effect to the Swiper slider JavaScript library.
The default Swiper effects are slide
, fade
, cube
, coverflow
or flip
but I want to add my custom effect with and all events. How can I do that?
1 Answer
Reset to default 6Go to the
s.effects
object (Effects part) inswiper.js
and add your own effect property like this: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 } }
To use your new effect do this:
var mySwiper = new Swiper( '.swiper-container', { // other options … // and add this effect: “myEffect” } );
For more information have a look here: https://github./nolimits4web/Swiper/issues/1497
本文标签: swiperjsHow to add custom effects to the Swiper slider JavaScript libraryStack Overflow
版权声明:本文标题:swiper.js - How to add custom effects to the Swiper slider JavaScript library? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742404815a2468605.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论