Closed swixpop closed 5 years ago
Thanks for reporting this bug. I'll have to take a look.
This can be reproduced via
flkty.next();
flkty.destroy()
Calling flkty._events = {};
after flkty.destroy();
stops events from being called, but this not enough, as the animation loop keeps going, even if I set flkty.isAnimating = false;
.
Maybe adding
if ( !this.isActive ) {
return;
}
to proto.animate
would help stopping the animation immediately?
Has there been any progress on this?
@lebowski89 I’ve been monkey-patching it like this:
const proto = Flickity.prototype;
const _animate = proto.animate;
proto.animate = function () {
if (!this.isActive) {
return;
}
_animate.call(this);
};
const _destroy = proto.destroy;
proto.destroy = function () {
_destroy.call(this);
this._events = {};
};
@jbach Good call. I'll be adding a similar fix in.
If I call flkty.destroy() while a slide transition is happening, the scroll event continues to fire. Other events are possibly firing as well. The result is that not all styles are being cleared from slides after destroy is called.