0

I've tried to implement a pause on hover event to jmpress slider for several days, but it doesn't work fine, it stops the loop after the first (or second) slide.

I tried with: setInterval, mouseenter/mouseleave, hover function, clearTimeout and many other options and functions, but nothing.

You can see the slider here: http://www.meraloasilonido.it/04/

This is the code, I edit it and it stops on hover but doesn't restart again, line 225 of jquery.jmslideshow.js (original file not edited: http://www.meraloasilonido.it/04/js/slider/jquery.jmslideshow.js):

_loadEvents         : function() {

        var _self = this;


        // ADD THIS EDIT
        if(this.options.hoverpause && this.options.autoplay){

        $('.jms-slideshow').on('mouseenter', function(e){

                _self._stopSlideshow();

                return false;

            } );

        $('.jms-slideshow').on('mouseleave', function(e){
                _self._startSlideshow();
                _self.$jmsWrapper.jmpress( 'next' );

                return false;

            } );

        }
        // STOP EDIT

Any suggestions?

Thanks in advance and sorry for my (bad) english. :/

nickhar
  • 19,981
  • 12
  • 60
  • 73
Ste Yeu
  • 157
  • 1
  • 8

1 Answers1

1

This is a bit late, but hopefully will help others with the same issue.

I had the same issue on a recent project; turns out we need to do one more thing to get the slideshow running: setting the autoplay option back to true.

If you notice the method _stopSlideshow, it actually has this.options.autoplay = false;

So, for the slideshow to start again on mouseleave, we simply reset the autoplay to true and call _startSlideshow:

$('.jms-slideshow').on('mouseleave', function(){
   _self.options.autoplay   = true;
   _self._startSlideshow();
});
smkndblvr
  • 91
  • 6