if($(".wel-banner .swiper-slide").length >1){ var banner = new Swiper('.wel-banner .swiper-container', { prevButton:'.wel-banner .swiper-button-prev', nextButton:'.wel-banner .swiper-button-next', pagination : '.wel-banner .swiper-pagination', paginationBulletRender: function (swiper, index, className) { return '' + '' + ''; }, paginationClickable: true, centeredSlides: true, slidesPerView: 1, spaceBetween: 0, initialSlide:0, speed:600, effect:'fade', autoplay : 6000, paginationClickable: true, // loop:true, slideToClickedSlide:true, autoplayDisableOnInteraction: false, lazyLoading : true, lazyLoadingInPrevNext : true, roundLengths : true, uniqueNavElements :false, noSwiping : true, onInit: function(swiper){ $(".wel-banner .secwen").removeClass('animate'); setTimeout(function(){ $(".wel-banner .swiper-slide-active .secwen").addClass('animate'); },100) var activeIndex = swiper.activeIndex; var videoIndex = $('.wel-banner .swiper-slide-active.videoboxs').index(); // var activeIndex = $('.wel-banner .swiper-slide-active').data('swiper-slide-index'); var banLen = $('.wel-banner .swiper-slide').length; $(".welbanner-pagination .li").eq(activeIndex).addClass("active").siblings().removeClass("active"); if(banLen==1){ swiper.stopAutoplay(); } if(videoIndex == activeIndex){ swiper.stopAutoplay(); $(".wel-banner .swiper-slide-active.videoboxs").find("video")[0].load(); $(".wel-banner .swiper-slide-active.videoboxs").find("video")[0].play(); } if($('.wel-banner .videoboxs').length>0){ $('.wel-banner .swiper-slide-active.videoboxs video').on('ended',function(){ setTimeout(function(){ swiper.slideNext(); swiper.startAutoplay(); swiper.params.autoplay = 6000; },500) }) } }, onTransitionStart: function(swiper){ $(".wel-banner .secwen").removeClass('animate'); setTimeout(function(){ $(".wel-banner .swiper-slide-active .secwen").addClass('animate'); },100) var activeIndex = swiper.activeIndex; var videoIndex = $('.wel-banner .swiper-slide-active.videoboxs').index(); // var activeIndex = $('.wel-banner .swiper-slide-active').data('swiper-slide-index'); $(".welbanner-pagination .li").eq(activeIndex).addClass("active").siblings().removeClass("active"); if(videoIndex == activeIndex){ $('.wel-banner .swiper-slide-active video')[0].play(); swiper.stopAutoplay(); } 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) }) } } }) $(".welbanner-pagination .li").on("click",function(){ $(".wel-banner .secwen").removeClass('animate'); setTimeout(function(){ $(".wel-banner .swiper-slide-active .secwen").addClass('animate'); },100) $(this).addClass("active").siblings().removeClass("active"); var index = $(this).index(); banner.slideTo(index,1000,false); }) // $(".welbanner-pagination .li").eq(0).click(); }else{ $(".wel-banner .secwen").addClass('animate'); $(".wel-banner video").attr("autoplay","autoplay"); $(".wel-banner video").attr("loop","loop"); } if($(window).innerWidth()<1024){ $(".wel-banner video").attr("scr",""); } gmains.backtops(0);