$(function () { var arrsvg = []; //if(navigator.maxTouchPoints==1){$("body").addClass("mobile")} document.querySelector(".mbanner .control").style.top = window.innerHeight - 100 + "px"; document.querySelector(".bb").style.top = window.innerHeight - 70 + "px"; const mvideo = document.querySelectorAll(".mbanner .swiper video"); mvideo[0].play(); $('.post-14 .news_list').slick({ infinite: true, slidesToShow: 1, autoplay: true, autoplaySpeed: 5000, slidesToScroll: 1, dots: false, vertical:true, arrows: false, }); var mbannerAwiper = new Swiper(".mbanner .swiper", { slidesPerView: 1, lazy: true, autoplay: { disableOnInteraction: false, delay: 10000, }, pagination: { el: ".mbanner .swiper-pagination", clickable: true, }, on:{ slideChangeTransitionEnd: function () { var actIndex = this.realIndex; mvideo.forEach(function (item, index) { if (index == actIndex && item.getAttribute("src") != "") { item.play(); mbannerAwiper.autoplay.stop(); $(item).on('ended',function(){ mbannerAwiper.slideNext(); mbannerAwiper.autoplay.start(); console.log('end') $(this).unbind(); }); } else { item.pause(); item.load(); } }); }, }, }); mbannerAwiper.autoplay.stop(); $(mvideo[0]).on('ended',function(){ mbannerAwiper.slideNext(); mbannerAwiper.autoplay.start(); console.log('1') $(this).unbind(); }) $(".mbanner .news .news_video").each(function () { if ($(this).find("video").attr("src") == "") { $(this).hide(); $(this).siblings(".news_imgs").show(); } else { $(this).show(); $(this).siblings(".news_imgs").hide(); } }); $(".main2 .sudy-tab").sudyTab({ handle: ".tab-menu li", content: ".tab-con .post", trigger: "mouseenter", start: 1, autoPlay: { active: false, }, }); var swiper12 = new Swiper(".post-12 .swiper", { slidesPerView: 1, lazy: true, autoplay: { disableOnInteraction: false, delay: 4000, }, pagination: { el: ".post-12 .swiper-pagination", clickable: true, }, navigation: { nextEl: ".post-12 .swiper-button-next", prevEl: ".post-12 .swiper-button-prev", }, }); var swiper26 = new Swiper(".post-26 .swiper", { slidesPerView: 1, lazy: { loadPrevNext: true, }, autoplay: { disableOnInteraction: false, delay: 5000, }, pagination: { el: ".post-26 .swiper-pagination", clickable: true, }, }); arrsvg = addFirstDom({ element: document.querySelectorAll(".post-31 .news .icon"), filepath: Path() + "images/icon", callback: false, }); addFirstDom({ element: document.querySelectorAll(".post-41 .news .news_icon"), filepath: Path() + "images/r_icon", callback: false, }); var swiper31 = new Swiper(".post-31 .swiper", { slidesPerView: 5, lazy: true, autoplay: { disableOnInteraction: false, delay: 5000, }, navigation: { nextEl: ".post-31 .swiper-button-next", prevEl: ".post-31 .swiper-button-prev", }, breakpoints: { 320: { //褰撳睆骞曞搴﹀ぇ浜庣瓑浜?20 slidesPerView: 3, }, 768: { //褰撳睆骞曞搴﹀ぇ浜庣瓑浜?68 slidesPerView: 4, }, 999: { //褰撳睆骞曞搴﹀ぇ浜庣瓑浜?280 slidesPerView: 5, }, }, }); if ($(window).width() < 1024) { $(".post-52 .news_list").slick({ infinite: true, slidesToShow: 2, autoplay: true, slidesToScroll: 2, vertical: true, arrows: false, }); } else { var mySwiper = new Swiper(".mainSwiper", { speed: 800, slidesPerView: 1, mousewheel: true, direction: "vertical", keyboard: { enabled: true, onlyInViewport: true, }, pagination: { el: ".mainSwiper>.swiper-pagination", clickable: true, renderBullet: function (index, className) { return ''; }, }, on: { transitionStart: function () { if (this.activeIndex != 0) { document.querySelector(".header").classList.add("fix"); $(".returnTop").addClass("show"); } else { document.querySelector(".header").classList.remove("fix"); $(".returnTop").removeClass("show"); } var activeIndex = this.activeIndex; var previousIndex = this.previousIndex; if (activeIndex == 0) { document.querySelector(".mainSwiper>.swiper-pagination").style.display = "none"; } else { document.querySelector(".mainSwiper>.swiper-pagination").style.display = "flex"; } // // 鍒ゆ柇婊戝姩鏂瑰悜 // if (activeIndex > previousIndex) { // // 鍚戜笅婊戝姩 // // 娣诲姞鍔ㄦ晥浠g爜锛屽浣跨敤animate.css搴 // var slide = this.slides[this.activeIndex]; // // 鍔ㄦ晥缁撴潫鍚庨噸缃牱寮 // setTimeout(function () { // slide.classList.add("showdiv"); // }, 250); // } else { // var slideprev = this.slides[this.previousIndex]; // slideprev.classList.remove("showdiv"); // } }, slideChangeTransitionEnd: function () { if (this.activeIndex == 3) { for (var i = 0; i < arrsvg.length; i++) { arrsvg[i].reset().play(); } swiper31.autoplay.start(); } else { swiper31.autoplay.stop(); } if (this.activeIndex == 0) { mbannerAwiper.autoplay.start(); } else { mvideo mbannerAwiper.autoplay.stop(); } }, }, }); document.querySelector(".bb").addEventListener("click", function () { mySwiper.slideTo(1, 1000, false); }); $(".returnTop").click(function () { mySwiper.slideTo(0, 1000, false); //鍒囨崲鍒扮涓€涓猻lide锛岄€熷害涓?绉 }); } $(".post-31 .num").countUp(); $(".main5 .mright .news .news_video").each(function () { if ($(this).find("video").attr("src") == "") { $(this).hide(); $(this).siblings("span").show(); } else { $(this).show(); $(this).siblings("span").hide(); } }); $(".post-41 .con").sudyTab({ handle: ".list1 li", content: ".list2 li", trigger: "mouseenter", start: 1, autoPlay: { active: false, }, }); const videos = document.querySelectorAll(".main5 .mright .news .news_video video"); const buttons = document.querySelectorAll(".main5 .mright .news .news_video .play"); buttons.forEach(function (button, index) { button.addEventListener("click", function () { videos.forEach(function (el, index2) { if (index != index2) { videos[index2].pause(); buttons[index2].classList.remove("pause"); } }); button.classList.toggle("pause"); if (button.classList.contains("pause")) { // 閸掋倖鏌囬崗鍐閺勵垰鎯侀崠鍛儓缁鎮 videos[index].play(); } else { videos[index].pause(); } }); }); });