2013-10-09 132 views
0

我需要重新加載圖像幻燈片播放時,因爲它是一個GIF動畫,並需要在開始幻燈片執行負荷圖像的jQuery旋轉木馬

我能做到這一點上點擊使用的if語句啓動當前類,但這不是我需要的方式,因爲我想爲幻燈片進來它儘快加載。到目前爲止,我有以下

this.$slides.eq(this.current).addClass('da-slide-current'); 

var image = new Image(); 
image.src = "kick.gif"; 

$("div").click(function() { 
    if ($(this).hasClass("da-slide-current")) { 
     $(this) 
     $('.da-slide-current > .da-img > img').attr('src', image.src); 

    } 
}); 

回答

0
var image = new Image(); 
image.src = "kick.gif"; 

this.$slides.eq(this.current) 
    .addClass('da-slide-current') 
    .find("> .da-img > img").attr('src', image.src); 
+0

感謝,但這隻適用的onload,而不是當幻燈片進來,所以如果圖像是在幻燈片2它不會發射 –

+0

你可以請顯示你的完整代碼或創建一個[小提琴](小時TTP://fiddle.net)?我不知道你是如何切換幻燈片的 – Spokey

+0

我使用的代碼點視差滑塊(http://tympanus.net/codrops/2012/03/15/parallax-content-slider-with-css3-and-jquery/ ),這裏是我的小提琴 http://jsfiddle.net/ktcle/JkRwv/1/ –

相關問題