$(function () { let scrollTop = document.documentElement.scrollTop $(window).scroll(function () { scrollTop = document.documentElement.scrollTop }) let screenWidth = $(window).innerWidth(); let cultureSloganActive = '1.8rem' let cultureSlogan = '1.36rem' if (screenWidth>=768) { cultureSloganActive = '1.8rem' cultureSlogan = '1.36rem' }else { cultureSloganActive = '2.1rem' cultureSlogan = '1.8rem' } $(window).resize(function () { screenWidth = $(window).innerWidth(); if (screenWidth>=768) { cultureSloganActive = '1.8rem' cultureSlogan = '1.36rem' }else { cultureSloganActive = '2.1rem' cultureSlogan = '1.8rem' } }); let locationId = location.hash.split('#')[1] if(locationId) { $('html, body').animate( { scrollTop: $('.about-us-position').eq(locationId).offset().top-50, }, { duration: 500, easing: 'swing' }, ) } window.onhashchange = function(event) { locationId = location.hash.split('#')[1] //通过location对象来获取hash地址 if(locationId) { $('html, body').animate( { scrollTop: $('.about-us-position').eq(locationId).offset().top-50, }, { duration: 500, easing: 'swing' }, ) } } $('.classify-title').eq(0).addClass('classify-title-active') $('.classify-title').click(function () { $(this).addClass('classify-title-active') $(this).siblings().removeClass('classify-title-active') $('html, body').animate( { scrollTop: $('.about-us-position').eq($(this).index()).offset().top-50, }, { duration: 500, easing: 'swing' }, ) }) const swiperAnalist = new Swiper('.swiperAnalist', { spaceBetween: 15, slidesPerView: 2.4, autoplay: true, loop: true, // navigation: { // prevEl: '.honor-next', // nextEl: '.honor-pre', // }, autoplay: { delay: 0, // 轮播间隔时间 disableOnInteraction: false, //用户操作swiper之后,是否停止自动切换效果 }, speed: 15000, breakpoints: { 680: { slidesPerView: 2.4, spaceBetween: 15, }, 1200: { slidesPerView: 4, spaceBetween: 50, }, 1920: { slidesPerView: 4, spaceBetween: 50, }, }, }) $('.culture-slogan').each(function(index) { if($('.culture-slogan').eq(index).find('.culture-slogan-circle p').text().length == 4) { const list = $('.culture-slogan').eq(index).find('.culture-slogan-circle p').text().split('') const txt1 = [list[0],list[1]].join('') const txt2 = [list[2],list[3]].join('') $('.culture-slogan').eq(index).find('.culture-slogan-circle p').html(`
${txt1}
${txt2}
`) } }) const sustainableSwiper = new Swiper('.sustainableSwiper', { spaceBetween: 15, slidesPerView: 2.2, autoplay: true, loop: true, navigation: { nextEl: '.sustainable-next', prevEl: '.sustainable-pre', }, autoplay: { delay: 3000, // 轮播间隔时间 disableOnInteraction: false, //用户操作swiper之后,是否停止自动切换效果 }, breakpoints: { 680: { slidesPerView: 2.8, spaceBetween: 20, }, 1200: { slidesPerView: 3, spaceBetween: 20, }, 1920: { slidesPerView: 3, spaceBetween: 30, }, }, }) const swiperHonor = new Swiper('.swiperHonor', { spaceBetween: 0, slidesPerView: 2.4, autoplay: true, loop: true, navigation: { nextEl: '.honor-next', prevEl: '.honor-pre', }, breakpoints: { 680: { slidesPerView: 2.4, }, 768: { slidesPerView: 4, }, 1200: { slidesPerView: 4, }, 1400: { slidesPerView: 4, }, 1920: { slidesPerView: 4, }, }, }) let language = location.search.split('=') let lang = language[location.search.split('=').length-1] let hasEn = location.pathname.split('/').includes('en') const historySwiper = new Swiper('.historySwiper', { slidesPerView: lang=='en'||hasEn?1:1.5, freeMode: true, loop: true, autoplay: { delay: 3000, // 轮播间隔时间 disableOnInteraction: false, //用户操作swiper之后,是否停止自动切换效果 }, navigation: { prevEl: '.history-pre', nextEl: '.history-next', }, breakpoints: { 680: { slidesPerView: 2.3, }, 1200: { slidesPerView: lang=='en'||hasEn?2.7:2.8, }, 1400: { slidesPerView: lang=='en'||hasEn?2.9:3.1, }, 1920: { slidesPerView: 3.65, }, 2560: { slidesPerView: 2.2, }, }, }) $('.swiper-slide-bottom').each( function (indexInArray, valueOfElement) { if($('.swiper-slide-bottom').eq(indexInArray).find('.history-year').text() == ''){ $('.swiper-slide-bottom').eq(indexInArray).css({display:'none'}) } }); $('.productSwiper-btn').mouseenter(function () { $(this).find('img').eq(0).hide() $(this).find('img').eq(1).show() }) $('.productSwiper-btn').mouseleave(function () { $(this).find('img').eq(0).show() $(this).find('img').eq(1).hide() }) $('.culture-img-list img').eq(0).css({ display: 'block' }) $('.culture-slogan') .eq(0) .css({ background: 'linear-gradient(180deg, #e5eff9, #ffffff)' }) $('.culture-slogan').eq(0).find('.culture-slogan-circle').css({ width: cultureSloganActive, height: cultureSloganActive, top: 'calc((-1.8rem + 1.13rem) / 2)', left: 'calc((-1.8rem + 1.13rem) / 2)', }) $('.culture-slogan').hover(function () { $(this).css({ background: 'linear-gradient(180deg, #e5eff9, #ffffff)' }) $(this).siblings('.culture-slogan').css({ background: '#fff' }) $(this).find('.culture-slogan-circle').css({ width: cultureSloganActive, height: cultureSloganActive, top: 'calc((-1.8rem + 1.13rem) / 2)', left: 'calc((-1.8rem + 1.13rem) / 2)', }) $(this).siblings('.culture-slogan').find('.culture-slogan-circle').css({ width: cultureSlogan, height: cultureSlogan, top: 'calc((-1.36rem + 1.13rem) / 2)', left: 'calc((-1.36rem + 1.13rem) / 2)', }) $('.culture-img-list img').eq($(this).index()).css({ display: 'block' }) $('.culture-img-list img') .eq($(this).index()) .siblings() .css({ display: 'none' }) }) })