var video = document.getElementById("pcvideo"); function vdieoresize(){ var W1= $(window).width(); var H1= $(window).height(); if ((W1/H1)>(16/9)) { $(".banner .videoboxs video").height(W1*9/16); }else{ $(".banner .videoboxs video").width(H1*16/9); } } // vdieoresize(); $(window).on("resize",function(){ // vdieoresize(); }) function numbox(num){ num=num.replace(/\b(0+)/gi,""); if(num == 0){ num = 0; }else if(num > 9){ num = num; }else{ num="0"+num; } return num; } if($(".wel-banner .swiper-slide").length >1){ var o = $(".wel-banner .swiper-container") var banner = new Swiper('.wel-banner .swiper-container', { autoplay: 5000,//鍙€夐€夐」锛岃嚜鍔ㄦ粦鍔 prevButton:'.wel-banner .swiper-button-prev', nextButton:'.wel-banner .swiper-button-next', pagination : '.wel-banner .swiper-pagination', // paginationType : 'fraction', paginationClickable: !0, speed: 1600, grabCursor: true, longSwipesRatio: .1, threshold: 20, parallax: !0, lazyLoading: !0, lazyLoadingInPrevNext: !0, autoplayDisableOnInteraction: false, centeredSlides: true, slidesPerView: 1, spaceBetween: 0, // noSwiping : true, // effect:"fade", loop:true, slideToClickedSlide:true, roundLengths : true, uniqueNavElements :false, breakpoints:{ 1023:{ noSwiping : false } }, onInit: function(swiper){ if($(window).innerWidth() >= 1024){ $(".wel-banner .secwen").removeClass('animate'); $(".wel-banner .swiper-slide-active .secwen").addClass('animate'); var i = swiper.activeIndex; var videoIndex = $('.wel-banner .swiper-slide-active.videoboxs').data('swiper-slide-index'); var activeIndex = $('.wel-banner .swiper-slide-active').data('swiper-slide-index'); var banLen = $('.wel-banner .swiper-slide').length; if(banLen==1){ swiper.stopAutoplay(); } if(videoIndex == activeIndex){ swiper.stopAutoplay(); $(".swiper-slide-active.videoboxs").eq(activeIndex).find("video")[0].load(); $(".swiper-slide-active.videoboxs").eq(activeIndex).find("video")[0].play(); } if($('.wel-banner .videoboxs').length>0){ $('.swiper-slide-active.videoboxs video').on('ended',function(){ setTimeout(function(){ swiper.slideNext(); swiper.startAutoplay(); swiper.params.autoplay = 6000; },500) }) } } }, onSlideChangeStart:function(swiper){ if($(window).innerWidth() >= 1024){ var videoIndex = $('.wel-banner .swiper-slide-active.videoboxs').data('swiper-slide-index'); var activeIndex = $('.wel-banner .swiper-slide-active').data('swiper-slide-index'); if(videoIndex == activeIndex){ $('.wel-banner .swiper-slide-active video')[0].load(); }else{ $('.index_pagination').show(); } } }, onLazyImageLoad: function(e, n, o) { $(n).append('
') }, onLazyImageReady: function(e, n, o) { $(n).find(".loader-icon").remove(), $(o).addClass("showin") }, onSliderMove: function(e) { o.find(".slide_transition").removeClass("slide_transition") }, onTransitionStart: function(e) { o.find(".trans_alpha, .headbg").addClass("slide_transition"), o.find(".autoplay").removeClass("autoplay"); if($(window).innerWidth() >= 1024){ $(".wel-banner .secwen").removeClass('animate'); setTimeout(function(){ $(".wel-banner .swiper-slide-active .secwen").addClass('animate'); },500) var i = e.activeIndex; var videoIndex = $('.wel-banner .swiper-slide-active.videoboxs').data('swiper-slide-index'); var activeIndex = $('.wel-banner .swiper-slide-active').data('swiper-slide-index'); if(videoIndex == activeIndex){ $('.wel-banner .swiper-slide-active video')[0].play(); e.stopAutoplay(); } if($('.wel-banner .videoboxs').length>0){ $('.swiper-slide-active.videoboxs video').on('ended',function(){ setTimeout(function(){ e.slideNext(); e.startAutoplay(); e.params.autoplay = 6000; },500) }) } } }, onSetTranslate: function(e, n) { for (var o = 0; o < e.slides.length; o++) { var a = e.slides[o] , t = a.progress , i = 1 - Math.min(Math.abs(t), 1) , s = 1 + Math.min(Math.abs(.2 * t), .2) , l = 50 , r = t * l; r > l && (r = l), r < -l && (r = -l), $(a).find(".trans_alpha").css("opacity", i), $(a).find(".headbg[data-swiper-parallax]").css("transform", "scale(" + s + ") translate3d(" + r + "%, 0px, 0px)") } }, onTransitionEnd: function(e){ $(".will-change").removeClass("will-change") e.autoplaying && o.find(".line").addClass("autoplay") if($(window).innerWidth() >= 1024){ var i = e.activeIndex; var videoIndex = $('.wel-banner .swiper-slide-active.videoboxs').data('swiper-slide-index'); var activeIndex = $('.wel-banner .swiper-slide-active').data('swiper-slide-index'); if(videoIndex == activeIndex){ $('.wel-banner .swiper-slide-active video')[0].play(); e.stopAutoplay(); } if($('.wel-banner .videoboxs').length>0){ $('.swiper-slide-active.videoboxs video').on('ended',function(){ setTimeout(function(){ e.slideNext(); e.startAutoplay(); e.params.autoplay = 6000; },500) }) } } } }) }else{ $(".wel-banner .secwen").addClass('animate'); } clickVideo($(".videoboxs .mvideo"))