Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto play doesn't resume after clicking prev / next #380

Closed
alexmccabe opened this issue Oct 18, 2012 · 7 comments
Closed

Auto play doesn't resume after clicking prev / next #380

alexmccabe opened this issue Oct 18, 2012 · 7 comments

Comments

@alexmccabe
Copy link

When clicking either the previous or next buttons the auto play does not continue and it is stuck on that slide. I know this is because of pauseOnAction, but it should replay on mouseOut.

@alexmccabe
Copy link
Author

Workaround $('.flex-next').click(function(){ $('.flexslider').flexslider("play") }); and $('.flex-prev').click(function(){ $('.flexslider').flexslider("play") });

The reason you do it this way is this: When you disable pauseOnAction, a user can click 6s into a 7s slide timer to change slide. Then 1s later it changes slide again.

Enable pauseOnAction and adding the two calls above pauses it then plays again from 0s so the time between is always 7s.

@ninhvanthang
Copy link

I have same issue but on ipad, iphone,
slider doesn't resume afteri swipe left or right
i tried disable pauseOnAction but not work

@MogulBren
Copy link

Thanks for the hint. I still couldn't get that to work out of the box, but used the jQuery .live method with great success. This is because (I assume) that the prev and next handles aren't available on $(document).ready where I placed this code?

Anyhoo, Thought this might help others searching for a solution/workaround.

$('.flex-next').live('click',function(){
    $('#flexSlider').flexslider("play");
});

Note my flexslider has a different ID / class to the OP

I see this is deprecated according to api.jquery.com. (I couldn't get the suggested .on method to work here though)

@bfncs
Copy link

bfncs commented Jun 19, 2013

You can do this very robustly in a callback. This also saves you from targeting all different kinds of user interaction possiblities (directionNav, controlNav, keyboard, mousewheel, etc.). Something along the lines of this should be fine:

$('#slideshow').flexslider({
  pauseOnAction: true, // default setting
  after: function(slider) {
    /* auto-restart player if paused after action */
    if (!slider.playing) {
      slider.play();
    }
  }
});

It would still be nice to have a simple option for this, though.

@marcoscurvello
Copy link

Im sorry I am a total noob here but where should I place the above snippet ?

@bfncs
Copy link

bfncs commented Sep 13, 2013

You would have to place this in a callback that is fired after all images are loaded. You could put this anywhere in your HTML after jQuery and Flexslider were referenced.

<script>
(function ($) {

  $(window).load(function() {

    /* code from above goes here */

  });

}(jQuery));
</script>

Have a look at the jQuery learning materials, they enable you to stop being a noob.
http://learn.jquery.com/

And: please head to stackoverflow or the likes for questions like this since this isn't a support forum but a bug tracker.

@sanntu
Copy link

sanntu commented Jan 2, 2014

@boundaryfunctions, thanks for enlightening us!

@jeffikus jeffikus closed this as completed Apr 1, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants