Reputation: 14293
I'm working with superslides and i'm trying to add some custom effects on the animations.
I was trying to do so like this:
on beforeChange
event, i want to stop the propagation of the event,
so that the slider doesnt change.
then, in here, i write my function to animate the elements that are inside the slider
once these animations are done, i then carry on and manually slide to the next element
The reason i decided to do this, was because i need the auto play to work, and this was the only idea i could come up with.
The code i have so far is the following:
var slider;
slider = $('.home-page-banner');
slider.superslides({
play: 5000
});
slider.on('animating.slides', function(evt) {
// tried all of the three below
evt.preventDefault();
evt.stopPropagation();
return slider.superslides('stop');
console.log(slider.superslides('next'));
slider.superslides('animate', slider.superslides('current'));
return slider.superslides('stop');
});
but unfortunately, it's not working as I'd like to. The slider detects the change, fires the event, changes the slide and only then it stops.
Any help on how to properly achieve this?
thanks
Upvotes: 0
Views: 666
Reputation: 856
preventDefault
and stopPropagation
will not work. Use custom Next and Previous buttons and write functions on them. Check this pen I forked your pen and modified it to match your needs. Start by clicking next, i used animate
to create a simple animation.
Upvotes: 1