$(".item2 .pro_r li").eq(0).addClass("on"); $(".item2 .pro_wrap .pro_l").eq(0).addClass("on"); $(".item2 .pro_r li").mouseenter(function () { $(this).addClass("on").siblings().removeClass("on"); $("#pro_icon").attr("src", "images/pro_" + ($(this).index() + 1) + ".png"); $(".item2 .pro_wrap .pro_l") .eq($(this).index()) .addClass("on") .siblings() .removeClass("on"); }); $(".item4 .pro_wrap>.pro_l>div").eq(0).addClass("on"); $(".item4 .pro_r li").hover(function () { var targetId = $(this).attr("data-targetId"); $("[data-id=" + targetId + "]") .addClass("on") .siblings() .removeClass("on"); $(this).addClass("on").siblings().removeClass("on"); $("#pro_icon2").attr("src", "images/pro4_" + ($(this).index() + 1) + ".png"); $(".item4 .pro_wrap>.pro_l ul") .eq($(this).index()) .addClass("on") .siblings() .removeClass("on"); }); $(".item5 .pro_wrap>.pro_l>div").eq(0).addClass("on"); $(".item5 .pro_r li").hover(function () { var targetId = $(this).attr("data-targetId"); $("[data-id=" + targetId + "]") .addClass("on") .siblings() .removeClass("on"); $(this).addClass("on").siblings().removeClass("on"); $("#pro_icon3").attr("src", "images/pro5_" + ($(this).index() + 1) + ".png"); $(".item5 .pro_wrap>.pro_l ul") .eq($(this).index()) .addClass("on") .siblings() .removeClass("on"); }); $(".s_btn>div").click(function () { var index = $(this).index(); $(".s_box").eq(index).addClass("on").siblings().removeClass("on"); $(this).addClass("on").siblings().removeClass("on"); }); var screen = new Swiper("#content", { direction: "vertical", mousewheel: true, observer: true, observeParents: true, on: { init: function () { swiperAnimateCache(this); //隐藏动画元素 swiperAnimate(this); //初始化完成开始动画 }, slideChangeTransitionEnd: function () { swiperAnimate(this); //每个slide切换结束时也运行当前slide动画 console.log(screen.realIndex); if (screen.realIndex == 0) { $("#head").addClass("firstWindow"); } else $("#head").removeClass("firstWindow"); //this.slides.eq(this.activeIndex).find('.ani').removeClass('ani'); 动画只展现一次,去除ani类名 if (screen.realIndex === 4) { $("#arrow").fadeOut(); } else { $("#arrow").fadeIn(); } }, }, }); // screen.slideTo(4, 1000, false) var item1_banner = new Swiper(".banner.swiper-container", { loop: true, // 循环模式选项 effect: "fade", observer: true, observeParents: true, pagination: { el: ".banner .T_icons", clickable: true, }, autoplay: { disableOnInteraction: false, }, }); var item3_num_banner = new Swiper(".num_tp>.swiper-container", { autoplay: true, slidesPerView: 4, slidesPerGroup: 4, spaceBetween: 43, pagination: { el: ".num_tp .swiper-pagination", }, observer: true, observeParents: true, }); var item3_banner = new Swiper(".item3_banner .swiper-container", { navigation: { nextEl: ".item3_banner .swiper-button-next", prevEl: ".item3_banner .swiper-button-prev", }, slidesOffsetBefore: 64, spaceBetween: 12, slidesPerView: "auto", loop: true, loopAdditionalSlides: 4, observer: true, observeParents: true, }); var galleryTop = new Swiper(".xysp .gallery-top", { observer: true, observeParents: true, on: { transitionStart: function () { var src = $(".xysp >.gallery-top-box .swiper-slide iframe") .eq(galleryTop.previousIndex) .attr("src"); $(".xysp >.gallery-top-box .swiper-slide iframe") .eq(galleryTop.previousIndex) .attr("src", src); }, }, }); var galleryThumbs = new Swiper(".xysp .gallery-thumbs", { centeredSlides: true, slidesPerView: 3, touchRatio: 0.2, slideToClickedSlide: true, slidesOffsetBefore: -293, observer: true, observeParents: true, on: { transitionStart: function () { var src = $(".xysp >.gallery-top-box .swiper-slide iframe") .eq(galleryTop.previousIndex) .attr("src"); $(".xysp >.gallery-top-box .swiper-slide iframe") .eq(galleryTop.previousIndex) .attr("src", src); }, }, navigation: { nextEl: ".gallery-thumbs .swiper-button-next", prevEl: ".gallery-thumbs .swiper-button-prev", }, }); galleryTop.controller.control = galleryThumbs; galleryThumbs.controller.control = galleryTop; //学习专栏视频 var galleryTop1 = new Swiper(".xxzl .gallery-top", { observer: true, observeParents: true, on: { transitionStart: function () { var src = $(".xxzl >.gallery-top-box .swiper-slide iframe") .eq(galleryTop.previousIndex) .attr("src"); $(".xxzl >.gallery-top-box .swiper-slide iframe") .eq(galleryTop.previousIndex) .attr("src", src); }, }, }); var galleryThumbs1 = new Swiper(".xxzl .gallery-thumbs", { centeredSlides: true, slidesPerView: 3, touchRatio: 0.2, slideToClickedSlide: true, slidesOffsetBefore: -293, observer: true, observeParents: true, on: { transitionStart: function () { var src = $(".xxzl >.gallery-top-box .swiper-slide iframe") .eq(galleryTop.previousIndex) .attr("src"); $(".xxzl >.gallery-top-box .swiper-slide iframe") .eq(galleryTop.previousIndex) .attr("src", src); }, }, navigation: { nextEl: ".gallery-thumbs .swiper-button-next", prevEl: ".gallery-thumbs .swiper-button-prev", }, }); galleryTop1.controller.control = galleryThumbs1; galleryThumbs1.controller.control = galleryTop1; // 弹窗 function setVideoSrc(element) { var videoUrl = element.getAttribute("data-video"); if (videoUrl.endsWith(".mp4")) { $("#dialog video").attr("src", videoUrl); } else { $("#dialog .dialog-content").html(''); } dialogVisible = true; } $(document).ready(function () { var dialogVisible = false; var dialogTitle = ""; // 监听打开对话框按钮点击事件 $("#openDialog").click(function () { dialogVisible = true; updateDialog(); }); // 监听关闭对话框按钮点击事件 $("#closeDialog").click(function () { dialogVisible = false; updateDialog(); }); // 更新对话框状态 function updateDialog() { if (dialogVisible) { $("#dialog").show(); } else { $("#dialog").hide(); } $("#dialogTitle").text(dialogTitle); } // 监听dialogVisible属性的变化 Object.defineProperty(window, "dialogVisible", { get: function () { return dialogVisible; }, set: function (value) { dialogVisible = value; updateDialog(); }, }); // 监听dialogTitle属性的变化 Object.defineProperty(window, "dialogTitle", { get: function () { return dialogTitle; }, set: function (value) { dialogTitle = value; updateDialog(); }, }); }); var galleryThumbs2_1 = new Swiper(".xyfg .s1 .gallery-thumbs", { spaceBetween: 30, slidesPerView: 4, loop: true, loopAdditionalSlides: 3, loopedSlides: 5, //looped slides should be the same watchSlidesVisibility: true, watchSlidesProgress: true, observer: true, observeParents: true, }); var galleryTop2_1 = new Swiper(".xyfg .s1 .gallery-top", { loop: true, loopedSlides: 5, //looped slides should be the same navigation: { nextEl: ".s1_next", prevEl: ".s1_prev", }, thumbs: { swiper: galleryThumbs2_1, }, observer: true, observeParents: true, }); var galleryThumbs2_2 = new Swiper(".xyfg .s2 .gallery-thumbs", { spaceBetween: 30, slidesPerView: 4, loop: true, loopAdditionalSlides: 3, loopedSlides: 5, //looped slides should be the same watchSlidesVisibility: true, watchSlidesProgress: true, observer: true, observeParents: true, }); var galleryTop2_2 = new Swiper(".xyfg .s2 .gallery-top", { loop: true, loopedSlides: 5, //looped slides should be the same navigation: { nextEl: ".xyfg .s2 .swiper-button-next", prevEl: ".xyfg .s2 .swiper-button-prev", }, thumbs: { swiper: galleryThumbs2_2, }, observer: true, observeParents: true, }); var galleryThumbs2_3 = new Swiper(".xyfg .s3 .gallery-thumbs", { spaceBetween: 30, slidesPerView: 4, loopAdditionalSlides: 3, loop: true, loopedSlides: 5, //looped slides should be the same watchSlidesVisibility: true, watchSlidesProgress: true, observer: true, observeParents: true, }); var galleryTop2_3 = new Swiper(".xyfg .s3 .gallery-top", { loop: true, loopedSlides: 5, //looped slides should be the same navigation: { nextEl: ".xyfg .s3 .swiper-button-next", prevEl: ".xyfg .s3 .swiper-button-prev", }, thumbs: { swiper: galleryThumbs2_3, }, observer: true, observeParents: true, });