0
我有一個全寬橫幅,我想淡入和淡出到不同的圖像中。它做它應該做什麼,但我的問題是在淡出期間顯示的白色背景 - 所以我正在尋找交叉淡入淡出......但不確定如何去做。全寬滑塊 - 交叉淡入淡出轉換問題
我的HTML是像這樣
<div id="backgroundimg">
<div class="row copy limitedwidth extra-pad">
<h1> Stay somewhere amazing </h1>
<h1> this summer </h1>
<p class="lrgfont hidden-xs">From city centre boutique to beach side mill, and arctic cabin to honeymoon suite. Discover our range of unique, friendly and affordable places to stay and you’ll never look at budget accommodation in the same way again! </p>
</div>
</div>
我的CSS是像這樣
#backgroundimg { background-image: url('/sites/default/files/Pwll_Deri_landing.jpg'); background-repeat: no-repeat; background-position: 50% 66%; border-bottom: 1px solid #AAA6A6; min-height: 295px; }
.image-0 { background-image: url('/sites/default/files/Pwll_Deri_landing.jpg') !important; background-position: 50% 66% !important; }
.image-1 { background-image: url('/sites/default/files/seaside-large.jpg') !important; background-position: 50% 66% !important; }
.image-2 { background-image: url('/sites/default/files/london-large.jpg') !important; background-position: 50% 66% !important; }
及以下
$(document).ready(function(){
var seconds = 5000;
var step = 0;
var limit = 3;
$("#backgroundimg").addClass("image-"+step).fadeIn(500);
setInterval(function(){
$("#backgroundimg").fadeOut(500,function(){
$(this).removeClass("image-"+step);
step = (step > limit) ? 0 : step + 1;
$("#backgroundimg").addClass("image-"+step).fadeIn(500);
});
},seconds);
});