请 - 没有 jQuery。
函数 1 使图像出现(CSS3 动画)。
函数 2 然后在这张幻灯片的底部向上滑动一个标题(CSS3 动画)。
函数 3 然后向下滑动标题(CSS3 动画)。
然后需要重复该过程。
我的问题:如何将这些函数放在一个连续循环中,每个函数之间都有延迟。
HTML 代码
<div id="slider">
<!-- Sildes
img_noshow means opacity:0;display:none;
img_show means opacity:1;
an_movein means a fade in effect CSS3
-->
<img id="img_1" class='img_show' src="/images/c1.jpg" style='width:960px;'/>
<img id="img_2" class='img_noshow' src="/images/c2.jpg" style='width:960px;'/>
<img id="img_3" class='img_noshow' src="/images/c3.jpg" style='width:960px;'/>
<img id="img_4" class='img_noshow' src="/images/c4.jpg" style='width:960px;'/>
<div id="slider_caption">
<p id="slider_p1" class="an_slideup"><a href="#one">This is the text going with the slide 1.</a></p>
<p id="slider_p2" class="img_noshow"><a href="#one">This is the text going with the slide 2.</a></p>
<p id="slider_p3" class="img_noshow"><a href="#one">This is the text going with the slide 3.</a></p>
<p id="slider_p4" class="img_noshow"><a href="#one">This is the text going with the slide 4.</a></p>
</div>
</div>
JAVASCRIPT代码
slide = 1;//global
function nextMove(){
slide++;
if(slide > 4){
slide = 1;
}
//img_noshow means opacity:0;display:none;
//img_show means opacity:1;
//an_movein means a fade in effect
for(i=1;i<5;i++){
document.getElementById('slider_p'+i).className = 'img_noshow';
if(i != slide){
document.getElementById('img_'+i).className = 'img_noshow';
}
else{
document.getElementById('img_'+i).className = 'an_movein';
}
}
}
function nextMove2(){
document.getElementById('slider_p'+slide).className = 'an_slideup';
}
function nextMove3(){
document.getElementById('slider_p'+slide).className = 'an_slidedown';
}