Fading Text On a Jquery Slider
My problem is this: I need to make a JQuery Image slider that resembles a flash video. 开发者_开发百科I've been successful so far as I have the slider going but i can't get the text. I need the text to fade in after the image shows, similar to to how it does on this page http://absolutetileandstone.com/ . I've tried just about everything i can think of, including .animate() and .fadeIn() but have gotten nowhere. I've even added 2 sliders together and tried to sync the timing, which was impossible... Any suggestions?
Here's the demo that has a slider inside a slider http://www.trileafweb.com/absolute
Hmm.. how about redoing the slider since the plugin doesn't natively do the text fade.
demo: http://jsfiddle.net/LQgw4/
html
<div id="container">
<div>
<span class="one">absolute</span>
<span class="two">hauuu~</span>
<img src="http://lorempixum.com/250/200/abstract/1" />
</div>
<div>
<span class="one">absolute</span>
<span class="two">uguu~</span>
<img src="http://lorempixum.com/250/200/abstract/2" />
</div>
<div>
<span class="one">absolute</span>
<span class="two">kyaa~</span>
<img src="http://lorempixum.com/250/200/abstract/3" />
</div>
<div>
<span class="one">blerg</span>
<span class="two">abalone</span>
<img src="http://lorempixum.com/250/200/abstract/4" />
</div>
</div>
css
#container img,
#container span {
display:none;
}
#container span.one,
#container span.two {
color:#fff;
font:bold 30px verdana;
position:absolute;
left:30px;
top:90px;
}
#container span.two {
left:130px;
top:120px;
font-size:20px;
}
jquery
$(document).ready(function() {
startSlider(0);
});
function startSlider(idx) {
$img = $("#container div img").eq(idx);
$span1 = $("#container div span.one").eq(idx);
$span2 = $("#container div span.two").eq(idx);
$img.fadeIn('slow', function() {
$span1.delay(600).fadeIn('slow', function() {
$span2.delay(600).fadeIn('slow', function() {
$span1.delay(600).fadeOut();
$span2.delay(600).fadeOut('fast', function() {
$img.fadeOut('slow', function() {
if ($("#container div img").length - 1 == idx) {
startSlider(0);
}
else {
startSlider(idx + 1);
}
});
});
});
});
});
}
or if you want that first text to not fade out: http://jsfiddle.net/azzWZ/
精彩评论