hilios / jQuery.countdown

The Final Countdown plugin for jQuery
http://hilios.github.io/jQuery.countdown/
MIT License
2.3k stars 720 forks source link

How To destroy instances #309

Open v4irajvimu opened 5 years ago

v4irajvimu commented 5 years ago

Hi, anyone know how to destroy countdown instance?

let inst = effThis.countdown(nextYear.toDate()) .on('update.countdown', function (event) { let displayDate = event.strftime('%D:%H:%M:%S'); $(this).html(event.strftime( self.getDisplayFormat(displayDate, $(this)))); //'%H:%M:%S' }) .on('finish.countdown', function () { effThis.html(""); console.log(count down finished ${raceId}); self.slide_carousel(); }); self.countdownInstance.push(inst);

that code snippet inside a function. i'm going to call it again and again. because my data collection may change. i want to destroy all old instances. so how do i get this done.

gitdorezende commented 4 years ago

I have the same problem.

plonknimbuzz commented 3 years ago

https://github.com/hilios/jQuery.countdown/issues/272#issuecomment-679070405

LrntL commented 3 years ago

Same here. So I "destroy" by using:

myJqueryObject.countdown(0);

Just before doing:

myJqueryObject.countdown('remove');