var ctn6 = new Swiper(".ctn6 .mySwiper", { centeredSlides: true, centeredSlidesBounds: true, autoplay: { delay: 1500,//1秒切换一次 }, initialSlide: 2, navigation: { nextEl: ".ctn6 .swiper-button-next", prevEl: ".ctn6 .swiper-button-prev", }, scrollbar: { el: ".ctn6 .swiper-scrollbar", draggable: true, dragSize: 200, }, breakpoints: { 1200: { slidesPerView: 4, spaceBetween: 50 }, 768: { slidesPerView: 3, spaceBetween: 20 }, 0: { slidesPerView: 1, spaceBetween: 0 }, } }); setTimeout(function(){ $(".ctn6 .ctn6_more").css("height", $(".ctn6 .swiper-wrapper").height()) },500) ctn6.el.onmouseover = function () { ctn6.autoplay.stop(); } ctn6.el.onmouseout = function () { ctn6.autoplay.start(); } $(".ctn6 .swiper-slide").on("mouseover", function () { $(".ctn6 .swiper-slide").removeClass("swiper-slide-active") $(this).addClass("swiper-slide-active") }) $(".ctn6 .swiper-slide").on("onmouseout", function () { $(this).removeClass("swiper-slide-active") }); $(window).on('load', function () { new WOW().init(); }); $('.ctn1,.ctn2,.ctn3,.ctn4').height($(window).height()) var ctn1_h = $('.ctn1').height() $(window).scroll(function () { var scrollTop = document.documentElement.scrollTop || document.body.scrollTop; if (scrollTop < ctn1_h) { $('.ctn2 .txt p').css('transform', 'scale(' + scrollTop / ctn1_h + ')') } var ctn4_t = $('.ctn3').offset().top + $('.ctn3').height() //console.log(ctn4_t,scrollTop) if (ctn4_t - scrollTop < 200) { $('.ctn4 .txt p,.ctn4 .txt .more,.ctn4 .txt span,.ctn4 .txt i').addClass('on') } else { $('.ctn4 .txt p,.ctn4 .txt .more,.ctn4 .txt span,.ctn4 .txt i').removeClass('on') } }) var Timeline = new TimelineMax(); Timeline.fromTo(".ctn2 .txt p", 3, { 'font-size': '120px' }, { 'font-size': '1200px' }) .addCallback(videopause) .fromTo(".ctn2 .txt", .5, { opacity: 1 }, { opacity: 0, onComplete: videoplay }) .to(".ctn2 .txt p", .5, { 'font-size': '1400px' }, 3) .to(".ctn2 .txt", 2.5, { opacity: 0 }) .addCallback(videotxtRemove) .addCallback(videotxtAdd) .to(".ctn2 .videotxt", 3, { opacity: 1 }) function videoplay () { $('.video video')[0].currentTime = 10.5 $('.video video')[0].play() } function videopause () { $('.video video')[0].currentTime = 10.5 $('.video video')[0].pause() } function videotxtAdd () { $('.videotxt .p1,.videotxt .p2,.videotxt .p3').addClass('on') } function videotxtRemove () { $('.videotxt .p1,.videotxt .p2,.videotxt .p3').removeClass('on') } let controller = new ScrollMagic.Controller(); let f_scene = new ScrollMagic.Scene({ triggerElement: ".ctn2", duration: "2500px",//滚动高度 triggerHook: 0, }) .setPin(".ctn2", {//需要固定的dom pushFollowers: true/*该属性可以用来设置是否看到运动的区域*/ }) .setTween(Timeline)//动画绑定到滚动条 //.addIndicators() //查看debug .addTo(controller) var sw_ctn4 = new Swiper('.sw_ctn4', { loop: true, speed: 2000, autoplay: { delay: 2000,//1秒切换一次 }, fadeEffect: { crossFade: true, }, pagination: { el: '.swiper-pagination', }, navigation: { nextEl: '.sw_ctn4 .swiper-button-next', prevEl: '.sw_ctn4 .swiper-button-prev', }, on: { slideChangeTransitionStart: function () { $('.ctn4 .sw_ctn4 .txt p,.ctn4 .sw_ctn4 .txt span,.ctn4 .sw_ctn4 .txt i,.ctn4 .sw_ctn4 .txt .more').removeClass('on') setTimeout(() => { $('.ctn4 .sw_ctn4 .txt p,.ctn4 .sw_ctn4 .txt span,.ctn4 .sw_ctn4 .txt i,.ctn4 .sw_ctn4 .txt .more').addClass('on') }, 500); } } }); $('.ctn5 .txt_l .tab p').on('click', function () { var idx = $(this).index() $('.ctn5 .txt_l .tab p').eq(idx).addClass('on').siblings().removeClass('on') $('.ctn5 .txt_l .ctn .des').eq(idx).addClass('on').siblings().removeClass('on') $('.ctn5 .txt_l .ctn .des').eq(idx).fadeIn().siblings().fadeOut() }) $('#modelBorderContainer').on('click', function () { $('#modelBorderContainer .s_tips').hide() }) $(window).scroll(function () { var toTop = $(window).scrollTop(); if (toTop >= "80") { $(".heade").slideUp("1000") } else { $(".heade").slideDown("1000") } }); var wow = new WOW({ boxClass: 'wow', animateClass: 'animated', offset: 0, mobile: true, live: true }); wow.init(); var swiper = new Swiper('.mySwiper1', { autoplay: { delay: 5000 }, speed: 1000, slidesPerView: 1, spaceBetween: 0, effect: 'fade', loop: false, pagination: { el: '.mySwiper1 .swiper-pagination', clickable: true, }, on: { init: function () { }, slideChangeTransitionStart: function () { var _target = this; var curVideo = this.$el.find(".swiper-slide-active").find("video"); $(".mySwiper1 .swiper-slide.swiper-slide-active").css("opacity", 1).siblings().css("opacity", 0); //暂停所有视频 function pauseAll (ele) { ele.find("video").each(function () { $(this)[0].pause(); }); } pauseAll(this.$el); //轮播间隔时间 _target.params.autoplay.delay = 5000; //判断当前激活元素是否有视频 if (curVideo.length > 0) { //console.log("有视频!"); this.autoplay.stop(); curVideo[0].currentTime = 0; curVideo[0].play(); curVideo[0].removeEventListener('ended', function () { }, false); curVideo[0].addEventListener('ended', function () { //console.log("视频播放结束!"); _target.slideNext(); }, false); } else { //console.log("无视频!"); _target.autoplay.start(); } }, slideChangeTransitionEnd: function () { } } }); $(function () { if (!isFrontEnv()) { $("body").addClass("act_ex") } })