You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There appears to be an issue when creating multiple timers, where the "options" from the last instantiated timer, override the values for the previous timers. The most obvious example of this can be seen in the callback or format. In the example below, I have two divs, with the id's of timerTest1 & timerTest2.
$("#timerTest1").timer({
duration: '3s',
format: '%H:%M:%S',
callback: function () {
$("#timerTest1").css("color", "red");
alert("This is the timerTest1 callback");
}
});
$("#timerTest2").timer({
duration: '5s',
format: '%M:%S',
callback: function () {
$("#timerTest2").css("color", "green");
alert("This is the timerTest2 callback");
}
});
From digging through the source, it appears that in the "TIMER PROTOTYPE" section, the options object always has the values of the last iteration.
Okay, I think I've found the culprit. I changed the $.extend line in the prototype & modified the secondsToTime to take a timer object as well. These two changes seem to have "fixed" the issue. timer.jquery.js.txt
There appears to be an issue when creating multiple timers, where the "options" from the last instantiated timer, override the values for the previous timers. The most obvious example of this can be seen in the callback or format. In the example below, I have two divs, with the id's of timerTest1 & timerTest2.
From digging through the source, it appears that in the "TIMER PROTOTYPE" section, the options object always has the values of the last iteration.
Sample file:
test.txt
The text was updated successfully, but these errors were encountered: