$(function() { $('.header .con .nav > ul > li:nth-child(1)').addClass('active'); $('.build .con .b-top .swiper-slide').each(function(i,v){ var t_title=$(this).find('h2').text().split('-'); $(this).find('h2').text(t_title[0]); $(this).find('h3').text(t_title[1]); $('.build .con .b-bottom .left ul li').eq(i).text(t_title[0]); }) var width = $(window).width(); var height = $(window).height(); if(!isFrontEnv()){ $('body').addClass('isFENV'); }else{ if(width>=1024){ $('.g-brief').height(height); var animationController = new ScrollMagic.Controller({ addIndicators: false }); var t1=new TimelineMax(); t1.to(".g-brief .right", 1, { top: "9vw", }); new ScrollMagic.Scene({ triggerElement: '.g-brief', duration: "300%", triggerHook: 'onLeave', }) .setPin('.g-brief') .setTween(t1) .addTo(animationController); } } if(height<=1080){ if(width>1024){ $('.banner .swiper-slide').css('height',height); }else{ $('.banner .swiper-slide').css('height','auto'); } } var banner = new Swiper('.banner .swiper-container', { speed: 1000, // autoplay:false, autoplay: { delay: 5000, stopOnLastSlide: false, disableOnInteraction: false, }, effect: 'fade', fadeEffect: { crossFade: true, }, pagination: { el: '.banner .swiper-pagination', clickable: true, } }); 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(); }); $('.g-brief .b-bottom .left .v-btn').click(function() { var videoUrl = $(this).attr('video-source'); $('#videoPopup video').attr('src', videoUrl); $('#videoPopup').show(); }); $('#videoPopup .closes').click(function() { $('#videoPopup').hide(); $('#videoPopup video')[0].pause(); }); $('.mySwiper3 .swiper-slide ul li h2').click(function() { var html = $(this).parent().parent().find('.h-tu').html(); $('.build-show .b-box').empty().html(html); $('.build-show').show(); var swiper1 = new Swiper(".build-show .mySwiper2", { spaceBetween: 20, slidesPerView: 4, freeMode: true, watchSlidesProgress: true, }); if (width > 998) { var swiper2 = new Swiper(".build-show .mySwiper1", { spaceBetween: 20, navigation: { nextEl: ".build-show .swiper-button-next", prevEl: ".build-show .swiper-button-prev", }, thumbs: { swiper: swiper1, }, }); } else { var swiper2 = new Swiper(".build-show .mySwiper1", { spaceBetween: 20, pagination: { el: '.build-show .mySwiper1 .swiper-pagination', clickable: true, } }); } }); $(document).on('click', '.build-show .closes', function() { $('.build-show').hide(); }); var build_bg = new Swiper('.build-bg .swiper-container', { speed: 1000, autoplay: false, effect: 'fade', fadeEffect: { crossFade: true, } }); var build_title = new Swiper('.build-title .swiper-container', { speed: 1000, autoplay: false, effect: 'fade', fadeEffect: { crossFade: true, } }); var swiper3 = new Swiper('.mySwiper3', { speed: 1000, autoplay: false, effect: 'fade', fadeEffect: { crossFade: true, } }); $('.build .con .b-bottom .left ul li:first-child').addClass('active'); $('.build .con .b-bottom .left ul li').click(function() { var index = $(this).index(); $(this).addClass('active').siblings().removeClass('active'); build_bg.slideTo(index); build_title.slideTo(index); swiper3.slideTo(index); }); })