Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author averta

    (@averta)

    Hi there is slideshow on slider settings but with play pause button no there is not.
    You can see all its related option under slider settings on “Navigation” part
    https://www.masterslider.com/doc/wp/free/#slider-settings

    Good luck

    Thread Starter katart17

    (@katart17)

    @averta

    I want to use the following function to create a Play/Pause toggle function:

    function(event) {
    
      var api = event.target;
    
      var autoplay = true;
      var mySlider;
    
      if(typeof api !== 'undefined') {
    	mySlider = api;
      } else {
        return;
      }
    
      var isPlaying = autoplay,
      	playPause = jQuery('<div class="prefix-play-pause" />'),
      	play = jQuery('<div class="prefix-play" />').appendTo(playPause),
      	pause = jQuery('<div class="prefix-pause" />').appendTo(playPause);
    
      if(!autoplay) {
        pause.hide();
        play.show();
      }
    
      playPause.on('click', function() {
    
        if(isPlaying) {
    
          pause.hide();
          play.show();
    
          mySlider.pause();
    
        } else {
    
          play.hide();
          pause.show();
    
          mySlider.resume();
    
        }
    
        isPlaying = !isPlaying;
    
      }).appendTo(jQuery('.ms-view'));
    
    }

    I’m using this with the on slider init callback but it doesn’t seem to be loading. This function worked with the on slide change start callback, but it was repeating the function after every slide transition.

    How can I get this working with the on slider init callback?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Play/Pause Toggle’ is closed to new replies.