// 首页banner var swiper1 = new Swiper(".indexBannerSwiper", { // autoplay: true, pagination: { el: ".indexBanner .menu .swiper-pagination", }, navigation: { nextEl: ".indexBannerSwiper .swiper-button-next", prevEl: ".indexBannerSwiper .swiper-button-prev", }, }); $('.swiper-backface-hidden .swiper-slide').each(function(){ let videoBannerUrl = $(this).children('.img').children('video').attr('src') if(videoBannerUrl == ''){ $(this).children('.img').children('video').css('display','none') $(this).children('.img').children('img').css('display','block') }else{ $(this).children('.img').children('video').css('display','block') $(this).children('.img').children('img').css('display','none') } }) // 关于英展距离左侧调整 $('.indexBlock .content').css('margin-left',navLeftArea) $(window).resize(function(){ let navLeftArea = $('.header .location').offset().left $('.indexBlock .content').css('margin-left',navLeftArea) }) // 关于英展数字滚动 $(function(){ var countCXArr = []; var countCX=function (){ $('.numCount').each(function(i, dom) { if(countCXArr[i] && countCXArr[i] === true){ return; } var sT; var ncTop; sT = $(window).scrollTop(); ncTop = $(dom).offset().top; var id,decimals, startVal, endVal, duration; if (sT > ncTop-$(window).height() && sT < ncTop) { $(dom).find('.numCX').each(function(){ id=$(this).attr('id'); decimals = $(this).attr('data-decimals'), startVal = $(this).attr('data-startVal'), endVal = $(this).attr('data-endVal'), duration = $(this).attr('data-speed'); new CountUp(id, startVal, endVal, decimals, duration, { useEasing: true,//效果 separator: ''//数字分隔符 }).start();// target:目标元素id, startVal:你想要开始的值, endVal:你想要到达的值, decimals:小数位数,默认值为0, duration:动画持续时间为秒,默认值为2, options:选项的可选对象 countCXArr[i] = true; }) } }) } countCX(); $(window).on("scroll",function() { countCX(); }) }); // 合作伙伴切换 var swiper = new Swiper(".indexBlock2Swiper", { spaceBetween: 20, slidesPerView: 1, navigation: { nextEl: ".indexBlock2 .swiper-button-next", prevEl: ".indexBlock2 .swiper-button-prev", }, pagination: { el: ".indexBlock2Swiper .swiper-pagination", type: "fraction", }, breakpoints:{ 768:{ slidesPerView: 2, }, 1200:{ slidesPerView: 3, spaceBetween: 47, } } }); $('.indexBlock2 .w1400 .swiper .swiper-wrapper .swiper-slide').hover(function(){ if($(window).width() > 996 ){ $(this).children().children('.text').children('.btn').children('img').eq(0).css('display','none') $(this).children().children('.text').children('.btn').children('img').eq(1).stop().fadeIn() } },function(){ $(this).children().children('.text').children('.btn').children('img').eq(0).stop().fadeIn() $(this).children().children('.text').children('.btn').children('img').eq(1).css('display','none') }) // 应用场景 var swiper = new Swiper(".indexBlock4Swiper", { slidesPerView: 1, spaceBetween: 20, navigation: { nextEl: ".indexBlock4 .swiper-button-next", prevEl: ".indexBlock4 .swiper-button-prev", }, breakpoints:{ 997:{ slidesPerView: 3, spaceBetween: 33, }, 1200:{ slidesPerView: 4, spaceBetween: 33, } } }); // 应用场景hover $('.indexBlock4 .w1400 .swiper .swiper-wrapper .swiper-slide').hover(function(){ if($(window).width() > 996 ){ $(this).children('.img').children('.play').stop().fadeIn() $(this).children('.img').children('.play').css('display','flex') $(this).children('.ico').children('img').eq(0).css('display','none') $(this).children('.ico').children('img').eq(1).stop().fadeIn() $(this).children('.text').children('.btn').children('img').eq(0).css('display','none') $(this).children('.text').children('.btn').children('img').eq(1).stop().fadeIn() } },function(){ $(this).children('.img').children('.play').fadeOut() $(this).children('.ico').children('img').eq(0).stop().fadeIn() $(this).children('.ico').children('img').eq(1).css('display','none') $(this).children('.text').children('.btn').children('img').eq(0).stop().fadeIn() $(this).children('.text').children('.btn').children('img').eq(1).css('display','none') }) // 应用场景图片点击播放视频 let block4Video = document.getElementById("media"); $('.indexBlock4 .w1400 .swiper .swiper-wrapper .swiper-slide .img').click(function(){ let videoURL = $(this).data('url') // let videoCover = $(this).data('img') $('.videoWindow').stop().fadeIn() $('.videoWindow .content video').attr('src',videoURL) // $('.videoWindow .content video').attr('poster',videoCover) $('.videoWindow .content video').attr('autoplay','true') }) $('.videoWindow .content .close').click(function(){ $('.videoWindow').stop().fadeOut() media.pause() setTimeout(function(){ $('.videoWindow .content video').attr('src','') $('.videoWindow .content video').attr('poster','') },300) }) document.addEventListener("WeixinJSBridgeReady", function () { document.getElementById('bannerVideo').play(); }, false);