我剛剛在我的網站上設置了一個Jquery圖像旋轉器,並且想要對其進行自定義,以便圖像不會旋轉,直到2秒過去。延遲JQuery圖像旋轉器旋轉2秒
我一直在試圖通過實現setTimeout函數(正確的地方,通過項目評論的循環),但它一直說我的函數沒有聲明,所以即時推測tt不會在那個地方工作。
$(window).load(function() { //start after HTML, images have loaded
var InfiniteRotator = {
init: function() {
//initial fade-in time (in milliseconds)
var initialFadeIn = 0;
//interval between items (in milliseconds)
var itemInterval = 2000;
//cross-fade time (in milliseconds)
var fadeTime = 1000;
//count number of items
var numberOfItems = $('.rotating-left').length;
//set current item
var currentItem = 0;
//show first item
$('.rotating-left').eq(currentItem).fadeIn(initialFadeIn);
//loop through the items
var infiniteLoop = setInterval(function() {
$('.rotating-left').eq(currentItem).fadeOut(fadeTime);
if (currentItem == numberOfItems - 1) {
currentItem = 0;
} else {
currentItem++;
}
$('.rotating-left').eq(currentItem).fadeIn(fadeTime);
}, itemInterval);
}
};
InfiniteRotator.init();
});
進出口使用的代碼從本網站http://trendmedia.com/news/infinite-rotating-images-using-jquery-javascript/
它聲明哪個函數沒有聲明? – 2012-08-10 02:26:12