{ $('.hswu-li').find('video')[0].play(); } }); ys.numRoll(".home-about-ul-li .std-tit1", false, 1000); if ($('.home-about-video').find('video').length > 0 && $(window).width() > 1199) { $('.home-about-video').find('video')[0].play(); } if ($(window).width() > 1199) { if ($(window).width() > 1681) { $('.home-about-video').attr('data-top', 'width: 100%;border-radius: 0px;'); $('.home-about-video').attr('data-100-bottom', 'width:48%;border-radius: 10px;'); $('.home-innov-btm').attr('data-center-top', 'width:1600px; height:80vh;'); $('.home-innov-btm').attr('data-top', 'width:2560px;height:100vh;'); } else if ($(window).width() < 1681 && $(window).width() > 1441) { $('.home-about-video').attr('data-top', 'width: 100%;border-radius: 0px;'); $('.home-about-video').attr('data-100-bottom', 'width:70%;border-radius: 10px;'); $('.home-innov-btm').attr('data-center-top', 'width:82.5%; height:80vh;'); $('.home-innov-btm').attr('data-top', 'width:100%;height:100vh;'); } else if ($(window).width() < 1441 && $(window).width() > 1200) { $('.home-about-video').attr('data-top', 'width: 100%;border-radius: 0px;'); $('.home-about-video').attr('data-100-bottom', 'width:70%;border-radius: 10px;'); $('.home-innov-btm').attr('data-center-top', 'width:82.5%; height:80vh;'); $('.home-innov-btm').attr('data-top', 'width:100%;height:100vh;'); } var i = 0; var timer = null; window.onscroll = function() { if (timer) { return; } timer = setTimeout(function() { var skr = skrollr.init({ forceHeight: false, smoothScrollingDuration: 600 }); timer = null; }, 100); }; } var mySwiperg = new Swiper('.home-innov-btm-swiper', { observeParents: true, //修改swiper的父元素时,自动初始化swiper observer: true, //修改swiper自己或子元素时,自动初始化swiper // freeMode: true, speed: 300, }); if ($(window).width() > 1199) { $(function() { videofixed(); }); $(window).on("load", function() { videofixed(); }); $(".home-innov-btm").appear(function() { if ($('.hibs-li').eq(0).find('video').length > 0 && $(window).width() > 1199) { $('.hibs-li').eq(0).find('video')[0].play(); } }); } else { $(".home-innov-btm-swiper").appear(function() { mySwiperg.autoplay.start(); }); $('.home-news-btm-ul').slick({ infinite: true, slidesToShow: 2, slidesToScroll: 1, dots: true, responsive: [{ breakpoint: 767, settings: { slidesToShow: 1, slidesToScroll: 1 } }] }).slickAuto(); } var lengthj = 1; function videofixed() { var parentTop; var parentHei; var winHei; var scrollTop; getPamara(); setStyle(); function getPamara() { var lengthj = $('.hibs-li').length; var hiegtp = lengthj * 100; $('.home-innov-cont').css('height', hiegtp + 'vh'); parentTop = $(".home-innov-cont").offset().top; parentHei = $(".home-innov-cont").height() - $(window).height(); winHei = $(window).height(); } var slickLength = mySwiperg.slides.length; var nowIndex = 0; var nextIndex = 0; function setStyle() { scrollTop = $(window).scrollTop(); var progress = parseFloat(((scrollTop - parentTop) / (parentHei)).toFixed(2)) * 1.5; // console.log(progress) slickLength = mySwiperg.slides.length; if (progress < 0) { progress = 0; } if (progress > 1) { progress = 1; } nextIndex = parseInt(progress * (slickLength - 1)); if (nowIndex != nextIndex) { nowIndex = nextIndex; if ($('.hibs-li').eq(nowIndex).find('video').length > 0 && $(window).width() > 1199) { $('.hibs-li').eq(nowIndex).find('video')[0].play(); $('.hibs-li').eq(nowIndex).siblings().find('video').trigger('pause'); }; mySwiperg.slideTo(nextIndex, 1000); } } $(window).scroll(function() { setStyle(); getPamara(); }) }