码迷,mamicode.com
首页 > 其他好文 > 详细

轮播图幻灯片

时间:2017-12-08 14:06:46      阅读:121      评论:0      收藏:0      [点我收藏+]

标签:color   隐藏   htm   order   osi   width   lun   显示   show   

html:

<div id="dlunbo">
        <div class="ig"><img src="img/100.jpg" /></div>
        <div class="ig"><img src="img/101.jpg" /></div>
        <div class="ig"><img src="img/103.jpg" /></div>
        <div class="ig"><img src="img/104.jpg" /></div>
        <div class="ig"><img src="img/105.jpg" /></div>
        <div class="ig"><img src="img/106.jpg" /></div>
</div>

css:

.ig img {
    width: 350px;
    border-radius: 30px;
}

.ig {
    position: absolute;
}

#dlunbo {
    width: 350px;
    height: 233px;
    position: absolute;
    top: 150px;
    left: 100px;
}

js:

var i = 0;
function startLunbo() {
    $(".ig").eq(0).show().siblings().hide();//第一张图片显示,其余的图片隐藏
    setInterval(function () {
        i++;
        if (i == 6) {
            i = 0;
        }
        $(".ig").eq(i).fadeIn(300).siblings().fadeOut(300);
    }, 4000);
}
$(function () {
    startLunbo();
})

 

轮播图幻灯片

标签:color   隐藏   htm   order   osi   width   lun   显示   show   

原文地址:http://www.cnblogs.com/huahua0825/p/8004609.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!