Last active
October 1, 2019 17:41
-
-
Save caike/dbc87c5816ec93b2b4797b245a6cb67f to your computer and use it in GitHub Desktop.
Example of updating timer on the fly
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function() { | |
const timer = $('.timer'); | |
timer.startTimer({ allowPause: true }); | |
setTimeout(() => { | |
timer.trigger('click'); | |
timer.data('timeLeft', 30); | |
timer.trigger('click'); | |
}, 3000); | |
}); | |
/* | |
* Try this with a <h1 class="timer" data-seconds-left="55"></h1> for example, | |
* and you should see it updating to 30 seconds at the 52 second mark | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment