nicinabox / superslides

A fullscreen, hardware accelerated slider for jQuery.
http://archive.nicinabox.com/superslides
MIT License
1.51k stars 443 forks source link

change slider on hover #332

Open fabiovaz opened 9 years ago

fabiovaz commented 9 years ago

$('.item').mouseenter(function() { $('.large').superslides('animate', ($(this).data('slide'))); });

works fine, but when i hover fast between "2 itens" the function to animate not overwrite the old request and show me a wrong slide

zamber commented 9 years ago

You're stacking multiple event calls one after another. Try something like this:

var $slides = $('.large');
var isAnimating = false;

$slides.bind('animating.slides', function() { isAnimating = true; });
$slides.bind('animated.slides', function() { isAnimating = false; });

$('.item').mouseenter(function() {
  if (!isAnimating) {
    $slides.superslides('animate', ($(this).data('slide')));
  }
});

Now close this issue as this is not a support forum but an issue tracker.