Follow along with the video below to see how to install our site as a web app on your home screen.
Бележка: This feature may not be available in some browsers.
var output, started, duration, desired;
// Constants
duration = 5000;
desired = '5';
// Initial setup
output = $('#output');
started = new Date().getTime();
// Animate!
animationTimer = setInterval(function() {
// If the value is what we want, stop animating
// or if the duration has been exceeded, stop animating
if (output.text().trim() === desired || new Date().getTime() - started > duration) {
clearInterval(animationTimer);
} else {
console.log('animating');
var randomNumber = Math.floor(Math.random() * 40) + 1;
output.text(randomNumber);
}
}, 100);