swiper.js - How to add custom effects to the Swiper slider JavaScript library? - Stack Overflow

I want to add a new custom effect to the Swiper slider JavaScript library.The default Swiper effects ar

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?

Share edited Jan 10, 2019 at 19:18 Giao1968 26k11 gold badges76 silver badges105 bronze badges asked May 17, 2017 at 9:09 miladfmmiladfm 1,52613 silver badges20 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 6
  1. Go to the s.effects object (Effects part) in swiper.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
       }
    }
    
  2. 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

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742404815a4437632.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信