JavaScript
- 80 ответов
- 0 вопросов
65
Вклад в тег
var image = new Image();
image.src = "image.jpg";
new Image().src = "image.jpg";
function preloadImages() {
for (var i = 0; i < arguments.length; i++) {
new Image().src = arguments[i];
}
}
preloadImages(
"images-1.jpg",
"images-2.jpg",
"images-3.jpg"
);
var pauseButton = document.querySelector(".pause-button"),
start = Date.now(),
duration = 3000,
timePassed,
paused;
var timer = setInterval(change, duration);
pauseButton.addEventListener("click", function() {
if (!paused) {
clearInterval(timer);
timePassed = Date.now() - start;
paused = true;
} else {
setTimeout(function() {
timer = setInterval(change, duration);
}, duration - timePassed);
paused = false;
}
}, false);
function change() {
// ...
}
var numbers = [0, 0, 0, 0, 0, 0, 0, 0, "101", "83", "13", "35"].map(Number);