图片轮播jQuery

 
 
  <script type="text/javascript">
        //图片轮播
        var bannerIndex = 0; bannerTimer = null;
        function banner() {
            ++bannerIndex;
            if (bannerIndex > 5) {
                bannerIndex = 0;
            }
            $(".turns li").eq(bannerIndex).find("a").addClass("circleCurrent").parent().siblings().find("a").removeClass("circleCurrent");
            $(".swiper-container li").eq(bannerIndex).show().siblings().hide();
 
        };
 
            $(document).ready(function () {
               // var swiper = new Swiper('.swiper-container', {
                //    pagination: '.swiper-pagination',
                 //   paginationClickable: true
              //  });
 
                //返回顶部
                $("#gotop").click(function () {
                    $("#content").animate({ scrollTop: "0px" }, 100);
                });
 
                bannerTimer = window.setInterval("banner()", 3000);
                //点击小点,切换图片
                $(".turns li").click(function () {
                    window.clearInterval(bannerTimer);
                    bannerTimer = null;
                    bannerIndex = $(this).index() - 1;
                    banner();
                    bannerTimer = window.setInterval("banner()", 3000);
                });
 
            });
 
    </script>
posted @ 2015-06-15 13:32  Pavilion  阅读(131)  评论(0编辑  收藏  举报