<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>
时间: 2024-10-13 05:01:38