function scrolltotop(scrollduration) { var scrollheight = window.scrolly, scrollstep = math.pi / (scrollduration / 15), cosparameter = scrollheight / 2; var scrollcount = 0, scrollmargin; requestanimationframe(step); function step() { settimeout(function () { if (window.scrolly != 0) { scrollcount = scrollcount + 1; scrollmargin = cosparameter - cosparameter * math.cos(scrollcount * scrollstep); window.scrollto(0, scrollheight - scrollmargin); requestanimationframe(step); } }, 15); } } var swiper = new swiper("#swipercontainer", { loop: true, speed: 1000, watchslidesprogress: true, autoplay: { disableoninteraction: false, delay: 5000, }, pagination: { el: ".swiper-pagination", clickable: true, }, onslidechangestart: function () { console.log("轮播图切换了"); // 在这里执行您想要的操作 }, }); var noticeswiper = new swiper("#swiper-notice", { speed: 1000, slidesperview: 1, spacebetween: 10, autoplay: { disableoninteraction: false, delay: 1000, }, breakpoints: { 1280: { //当屏幕宽度大于等于1280 slidesperview: 3, spacebetween: 10 } } }); var swipernews = new swiper("#swiper-news", { loop: true, speed: 1000, effect: 'fade', watchslidesprogress: true, autoplay: { disableoninteraction: false, delay: 5000, }, pagination: { clickable:true, el: ".swiper-pagination", }, onslidechangestart: function () { console.log("轮播图切换了"); // 在这里执行您想要的操作 }, }); window.addeventlistener('resize', function () { settimeout(function () { swipernews.update(); }, 300); // 延迟时间可根据实际情况调整 }); var swiperset = new swiper("#swiper-set", { loop: true, speed: 1000, watchslidesprogress: true, autoplay: { disableoninteraction: false, delay: 5000, }, pagination: { el: ".swiper-pagination", }, onslidechangestart: function () { console.log("轮播图切换了"); // 在这里执行您想要的操作 }, }); var swiperparty = new swiper("#swiper-party", { loop: true, speed: 1000, watchslidesprogress: true, autoplay: { disableoninteraction: false, delay: 5000, }, pagination: { el: ".swiper-pagination", }, onslidechangestart: function () { console.log("轮播图切换了"); // 在这里执行您想要的操作 }, }); var f4myswiper = new swiper("#f4myswiper", { slidesperview: 1, spacebetween: 10, pagination: { el: ".f4swiper-pagination", clickable: true, }, navigation: { nextel: ".f4swiper-button-next", prevel: ".f4swiper-button-prev", }, breakpoints: { "@0.00": { slidesperview: 1, spacebetween: 10, }, "@0.75": { slidesperview: 2, spacebetween: 20, }, "@1.00": { slidesperview: 3, spacebetween: 40, }, "@1.50": { slidesperview: 6, spacebetween: 22, }, }, }); var swiper2 = new swiper("#swiper-business", { loop: true, speed: 1000, watchslidesprogress: true, autoplay: { disableoninteraction: false, delay: 5000, }, onslidechangestart: function () { console.log("轮播图切换了"); // 在这里执行您想要的操作 }, }); swiper.on("slidechange", () => { console.log("轮播图切换了", swiper.activeindex); $(".swiper-slide .en-title").hide(); $(".swiper-slide .ch-title").hide(); settimeout(() => { $(".swiper-slide .en-title").show(); $(".swiper-slide .ch-title").show(); // $('.swiper-slide .swiper-slide-active').addclass('init-img') $(".swiper-slide .en-title").addclass( "animate__animated animate__slideinleft" ); $(".swiper-slide .ch-title").addclass( "animate__animated animate__slideinright" ); }, 1000); settimeout(() => { $(".swiper-slide .en-title").removeclass( "animate__animated animate__slideinleft" ); $(".swiper-slide .ch-title").removeclass( "animate__animated animate__slideinright" ); }, 2000); settimeout(() => { // $(".swiper-slide img").removeclass('init-img') }, 4999); }); $(".keshi-item").click(function () { // 移除其他keshi-item的active类 $(".keshi-item").not($(this)).removeclass("active"); // 给当前keshi-item添加active类 $(this).addclass("active"); });