Jquery Nivo Slider set delay time for each slide

前端 未结 1 480
一整个雨季
一整个雨季 2021-01-22 08:27

We are using a special system that allows our users to set a delay between slides and whether or not the image contains a link. We were using mootools for the slideshow but wis

相关标签:
1条回答
  • 2021-01-22 09:27

    I'm using an array with 'afterLoad' and it works good.

      var delays = [4000,3000,5000,3000]; //your delay array
    
        function pageLoad() {
            $(function () {
                $('#slider').nivoSlider({
                    pauseTime: 50000,
                    directionNav: true,
                    afterChange: function () { setDelay() },
                    afterLoad: function () { setDelay() },
                    controlNav: true,
                    pauseOnHover: false
                });
            });
        }
    
        function setDelay() {
            var currentSlide = $('#slider').data("nivo:vars").currentSlide;
            setTimeout(function () {
                $('#slider').find('a.nivo-nextNav').click()
            }, delays[currentSlide]);
    
        }
    

    hope this helps. The rest of your html is standar nivo layout

    0 讨论(0)
提交回复
热议问题