将文本添加到Jquery SlideShow

时间:2015-07-26 20:06:00

标签: jquery html css slideshow

我是jquery的新手,我试图在我的幻灯片中添加文字,我只想添加带描述的文字,但每次添加一个li标签,幻灯片停止我都无法解决问题?

<div id="slideshow">

    <img src="http://s5.postimg.org/mcs14gnef/cully_slider_foundation.jpg"><alt=1>
    <img src="http://s5.postimg.org/psfk09v93/cully_slider2.jpg"><alt=2>
    <img src="http://s5.postimg.org/72nkjj2if/cully_slider3.jpg"><alt=3>
    <img src="http://s5.postimg.org/dj14nd0fr/cully_slider4.jpg"><alt=4>

    </div>



#slideshow {
    position:relative;
    height:350px;
}



function slideSwitch() {
    var $active = $('#slideshow IMG.active');

    if ( $active.length == 0 ) $active = $('#slideshow IMG:last');

    var $next =  $active.next().length ? $active.next()
        : $('#slideshow IMG:first');

    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}

$(function() {
    setInterval( "slideSwitch()", 5000 );
});

0 个答案:

没有答案