/ 设置 10 秒超时 // 每日统计清 0 runtime_set('todaycomments', 0); runtime_set('todayarticles', 0); runtime_set('todayusers', 0); if ($forumlist) { $fidarr = array(); foreach ($forumlist as $fid => $forum) { $fidarr[] = $forum['fid']; } forum_update($fidarr, array('todayposts' => 0, 'todaythreads' => 0)); } // 清理临时附件 attach_gc(); // 当天24点 $today = strtotime(date('Ymd')) + 86400; runtime_set('cron_2_last_date', $today, TRUE); // 往前推8个小时,尽量保证在前一天 升级过来和采集的数据会很卡 // table_day_cron($time - 8 * 3600); cache_delete('cron_lock_2'); } } } ?>swiper.js - How to add custom effects to the Swiper slider JavaScript library? - Stack Overflow|Concepts Of Algorithm

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

admin2025-03-20  10

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

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1742404816a212032.html

最新回复(0)