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

Carousel - pausing while sliding (during transition) breaks the pause/resume control #5747

Closed
sn3p opened this issue Nov 2, 2012 · 8 comments
Labels

Comments

@sn3p
Copy link

sn3p commented Nov 2, 2012

Pausing the carousel while sliding / during transition breaks the pause/resume control.
This happens when:

  • hovering (mouseenter) during transition.
  • calling .carousel('pause') during transition.

From this point on the carousel keeps cycling and there's no way stopping/pausing it anymore. Not on hover/mouseenter and not even with .carousel('pause').

Anyone else experiencing this problem, and maybe found a workaround?

http://jsfiddle.net/ANfXq/1/

@Yohn
Copy link
Contributor

Yohn commented Nov 2, 2012

I'm playing with the carousel now and discovered this problem to.. from what I can see it only happens with you hover over the carousel while its in the middle of a slide, so before it gets done sliding..

it also happens on the example page - http://twitter.github.com/bootstrap/examples/carousel.html

@sn3p
Copy link
Author

sn3p commented Nov 2, 2012

@Yohn, thanks for confirming.
I've updated my bugreport because the problem not only occurs on mouseenter, but also when calling .carousel('pause'). It indeed happens only while sliding/during transition.

This problem is easy to reproduce by calling the next and pause methods right after each other:
$('.carousel').carousel('next').carousel('pause');

UPDATE
The problem seems to be caused by the pause method, in bootstrap-carousel.js at line 71:

if (this.$element.find('.next, .prev').length && $.support.transition.end) {
  this.$element.trigger($.support.transition.end)
  this.cycle()
}

What's the logic in resuming cycle when it's just told to pause?
Why not finish the current transition and then pause (aka remove the code above)?

@andreif
Copy link

andreif commented Dec 9, 2012

Removing this.cycle() solved the problem for me. See also a 6-month old thread on the issue: 555a3b0#commitcomment-1409450

@thelittlebug
Copy link

I also can see that the actual slide is removed if you hover in between a transition. This gives a not so nice flickering.
I have remove this whole piece of code, and now every problem is gone.

if (this.$element.find('.next, .prev').length && $.support.transition.end) {
  this.$element.trigger($.support.transition.end)
  this.cycle()
}

But i just wonder what's this piece of code for? :)

@Yohn Yohn mentioned this issue Dec 20, 2012
@Yohn
Copy link
Contributor

Yohn commented Dec 20, 2012

@andreif you want to submit a pull request removing this.cycle() from the pause function? I just did a lot of testing with it and everything seems to work correctly, including calling .carousel('pause')

@fat
Copy link
Member

fat commented Feb 8, 2013

think this was resolved

@fat fat closed this as completed Feb 8, 2013
@Yohn
Copy link
Contributor

Yohn commented Feb 8, 2013

@fat this has been resolved with the clear interval -> a866a51 I was testing it yesterday and couldnt find anymore of the carousel bugs that were popping up

@prionkor
Copy link

So, what should i change in the code? I am currently working on a bootstrap project I would like to fix it before i put the site on production.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants