我有一個用JavaScript編寫的函數,它允許我滾動以特定間隔迭代的圖像數組,現在我想通過在鼠標懸停在任何位置時暫停旋轉來添加更多功能數組中的圖像。暫停懸停功能
的Javascript
(function() {
var rotator = document.getElementById('bigImage');
var imageDir = '../images/headers/';
var delayInSeconds = 5;
var images = ['ImageOne.png', 'ImageTwo.png', 'ImageThree.png', 'ImageFour.png',
'ImageFive.png',
'ImageSix.png'];
var num = 0;
var changeImage = function() {
var len = images.length;
bigImage.src = imageDir + images[num++];
if (num == len) {
num = 0;
}
};
setInterval(changeImage, delayInSeconds * 1000);
})();
是哪一個'rotator'或'bigImage'!? – Alexander