//轮播图 let swiper = new Swiper("#swiper1", { pagination: { el: ".swiper-pagination" }, loop: true, //循环 observer: true,//修改swiper自己或子元素时,自动初始化swiper observeParents: true,//修改swiper的父元素时,自动初始化swiper speed: 500, autoplay: { disableOnInteraction: false, //触碰后自动轮播也不会停止 delay: 3000, } }); //上一页、下一页 var pageNum = 1;//默认第一页 function lastPage(){ $('.aboutus-page .box5-content .page-box .img.first1').addClass('active'); $('.aboutus-page .box5-content .page-box .img.last1').removeClass('active'); pageNum = pageNum>1?pageNum-1:1; $(".aboutus-page .box5-content .cards").animate({ scrollLeft: ($(window).width()*0.25*(pageNum-1)*3 + 20*(pageNum-1)*3) },300) } function nextPage(){ $('.aboutus-page .box5-content .page-box .img.last1').addClass('active'); $('.aboutus-page .box5-content .page-box .img.first1').removeClass('active'); pageNum +=1; $(".aboutus-page .box5-content .cards").animate({ scrollLeft: ($(window).width()*0.25*(pageNum-1)*3 + 20*(pageNum-1)*3) },300) } //切换卡片 switchCard();//初始化 function switchCard(){ if($('.box6-content .cards.index1').hasClass('first')){ $('.box6-content .cards.index1').removeClass('first'); $('.box6-content .cards.index1').addClass('last'); $('.box6-content .cards.index2').removeClass('last'); $('.box6-content .cards.index2').addClass('first'); $('.box6-content .cards.index1').animate({ "opacity": 0.2, "z-index": 0, "transform": 'rotate(-10deg)', },800); $('.box6-content .cards.index1 .card div').animate({ "opacity": 0 }) $('.box6-content .cards.index2').animate({ "opacity": 1, "z-index": 100, "transform": 'rotate(0)' },800); $('.box6-content .cards.index2 .card div').animate({ "opacity": 1 }) }else{ $('.box6-content .cards.index1').removeClass('last'); $('.box6-content .cards.index1').addClass('first'); $('.box6-content .cards.index2').removeClass('first'); $('.box6-content .cards.index2').addClass('last'); $('.box6-content .cards.index2').animate({ "opacity": 0.2, "z-index": 0, "transform": 'rotate(-10deg)' },800); $('.box6-content .cards.index2 .card div').animate({ "opacity": 0 }) $('.box6-content .cards.index1').animate({ "opacity": 1, "z-index": 100, "transform": 'rotate(0)' },800); $('.box6-content .cards.index1 .card div').animate({ "opacity": 1 }) } } //上一页、下一页 function lastPage2(){ switchCard(); $('.aboutus-page .box6-content .page-box .img.first2').addClass('active'); $('.aboutus-page .box6-content .page-box .img.last2').removeClass('active'); } function nextPage2(){ switchCard(); $('.aboutus-page .box6-content .page-box .img.first2').removeClass('active'); $('.aboutus-page .box6-content .page-box .img.last2').addClass('active'); }