jQuery的3D轮播效果,带底部图片按钮-洋葱先生-杨少通

洋葱先生-杨少通感谢您的到来

这是一个3D轮播的效果,希望大家喜欢!

预览效果                下载文档     

代码如下:

3D轮播效果
  •             <li>
                    <img src="images/172141456_R.jpg" />
                </li>
                <li>
                    <img src="images/172141456_R.jpg" />
                </li>
                <li>
                    <img src="images/184449150_R.jpg" />
                </li>
                <li>
                    <img src="images/195001998_R.jpg" />
                </li>
            </ul>
            <a class="spread-ban-download" href="#" title="下载该推广">点击下载</a>
            <div class="spd-ban-mesh">
                <ul class="spread-ban-small">
                    <li>
                        <img src="images/092950120_R.jpg" />
                    </li>
                    <li>
                        <img src="images/105953334_R.jpg" />
                    </li>
                    <li>
                        <img src="images/112020805_R.jpg" />
                    </li>
                    <li>
                        <img src="images/121306920_R.jpg" />
                    </li>
                    <li>
                        <img src="images/151817631_R.jpg" />
                    </li>
                    <li>
                        <img src="images/171852304_R.jpg" />
                    </li>
    
                    <li class="img-focus">
                        <img src="images/172141456_R.jpg" />
                    </li>
                    <li>
                        <img src="images/172141456_R.jpg" />
                    </li>
                    <li>
                        <img src="images/184449150_R.jpg" />
                    </li>
                    <li>
                        <img src="images/195001998_R.jpg" />
                    </li>
                    <li>
                        <img src="images/092950120_R.jpg" />
                    </li>
                    <li>
                        <img src="images/105953334_R.jpg" />
                    </li>
                    <li>
                        <img src="images/112020805_R.jpg" />
                    </li>
                    <li>
                        <img src="images/121306920_R.jpg" />
                    </li>
                    <li>
                        <img src="images/151817631_R.jpg" />
                    </li>
                    <li>
                        <img src="images/171852304_R.jpg" />
                    </li>
    
                    <li>
                        <img src="images/172141456_R.jpg" />
                    </li>
                    <li>
                        <img src="images/172141456_R.jpg" />
                    </li>
                    <li>
                        <img src="images/184449150_R.jpg" />
                    </li>
                    <li>
                        <img src="images/195001998_R.jpg" />
                    </li>
                </ul>
                <b class="spd-btn spd-btn-lt">&lt;</b>
                <b class="spd-btn spd-btn-rt">&gt;</b>
            </div>
        </div>
    </div>
    <h3 class="go-back" ><a href="javascript:history.go(-1);" >返回上一页</a></h3>
    <script src="js/jquery.js"></script>
    <script type="text/javascript">
        //洋葱先生
        $(function () {
            var cloneIndex, imgFocus=6, imgSize, leftDistance = 0;
            imgSize = $(".spread-ban-big li").size();
            $(".spread-ban-big li,.spread-ban-small li").append("<p></p>");
            for (cloneIndex = 0; cloneIndex < 3; cloneIndex++) {
                $(".spread-ban-big").append($(".spread-ban-big li").eq(cloneIndex).clone().removeClass("img-focus-lt1 img-focus-lt2 img-focus-lt3"));
            }
            $(".spread-ban-big li").click(function () {
                imgFocus = $(this).index();
                fun3DBanner()
            })
            $(".spread-ban-small li").click(function () {
                imgFocus = $(this).index();
                fun3DBanner()
            })
            $(".spd-btn-lt").click(function () {
                imgFocus--;
                fun3DBanner()
            })
            $(".spd-btn-rt").click(function () {
                imgFocus++;
                fun3DBanner()
            })
            var bannerAuto=setInterval(function(){
                imgFocus++;
                fun3DBanner();
            }, 3000);
            $(".spread-banner").hover(function () {
                clearInterval(bannerAuto);
            }, function () {
                bannerAuto = setInterval(function () {
                    imgFocus++;
                    fun3DBanner();
                }, 3000);
            })
            function fun3DBanner() {
              //  var imgSrc = $(this).find("img").attr('src');
              //  $(".spread-ban-download").attr("href", "imgSrc");
                if (imgFocus >= imgSize) {
                    imgFocus -= imgSize;
                }
                if (imgFocus > 11) {
                    if (imgFocus == imgSize - 1)
                        $(".spread-ban-small li").css(" left", "auto");
                    else
                        $(".spread-ban-small li").animate({ left: -69 * (imgFocus - 11) }, 500);
                }
                if (imgFocus < 7) {
                    $(".spread-ban-small li").css("left", "auto");
                }
                if (imgFocus < 0) {
                    $(".spread-ban-small li").animate({ left: -69 * (imgSize - 13) }, 500);
                    imgFocus=imgSize-1;
                }
                $(".spread-ban-big li").eq(imgFocus).addClass("img-focus").siblings().removeClass("img-focus");
                $(".spread-ban-small li").eq(imgFocus).addClass("img-focus").siblings().removeClass("img-focus");
                for (var i = 1; i <= 3; i++) {
                    $(".spread-ban-big li").eq(imgFocus - i).addClass("img-focus-lt" + (4 - i)).siblings().removeClass("img-focus-lt" + (4 - i));
                    $(".spread-ban-big li").eq(imgFocus + i).addClass("img-focus-rt" + (4 - i)).siblings().removeClass("img-focus-rt" + (4 - i));
                }
            }
        })
    </script>
    
代码均为原创,存在不足还请见谅!

如有转载请注明来源: www.dreamload.cn/blog/?p=536&preview=true (洋葱先生-杨少通)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值