$(function () { // var images = $('.lazyload') // function callback(entries) { // for (let i of entries) { // if (i.isIntersecting) { // let img = i.target // let trueSrc = img.getAttribute('data-src') // img.setAttribute('src', trueSrc) // img.addEventListener('load', function () { // setTimeout(function () { // img.classList.remove('lazyload') // }, 1200) // }) // observer.unobserve(img) // } // } // } // const observer = new IntersectionObserver(callback) // for (let i of images) { // observer.observe(i) // } // kv var mySwiperKv = new Swiper('.ias-car-kvbanner', { // direction: "vertical", loop: true, pagination: { el: '.swiper-pagination-kv', clickable: true, }, navigation: { nextEl: '.swiper-button-next-kv', prevEl: '.swiper-button-prev-kv', }, slidesPerView: 1, speed: 500, loop: true, // 20250925 autoplay: { delay: 3000, disableOnInteraction: false, }, autoplay: false, spaceBetween: 4, keyboard: true, observer: true, observeParents: true, on: { transitionStart: function (mySwiper) { $('.ias-car-kvbanner').find('img').trigger('appear'); }, }, }); // 乾崑车控 轮播一 var mySwiper = new Swiper('.as-tpl-hm-banner01', { // direction: "vertical", loop: false, pagination: { el: '.swiper-pagination01', clickable: true, renderBullet: function (index, className) { switch (index) { case 0: text = '全域融合 全维协同'; break; case 1: text = '全场景爆胎稳定控制'; break; case 2: text = '全场景防滑稳定控制'; break; case 3: text = '时空推理悬架网络'; break; case 4: text = ''; break; } return ( // '' + text + "" ; '' + text + '' ); }, }, navigation: { nextEl: '.swiper-button-next01', prevEl: '.swiper-button-prev01', }, slidesPerView: 1, speed: 500, loop: false, autoplay: false, spaceBetween: 4, keyboard: true, observer: true, observeParents: true, on: { transitionStart: function (mySwiper) { var sliderwidth = $('.ias-tpl-hm-section03-01 .swiper-pagination-bullet').outerWidth(); var allwidth = sliderwidth * this.activeIndex; var wd = allwidth + 'px'; $('.ias-tpl-hm-section03-01 .ias-tpl-hm-tool .ias-tpl-pagination-bg').css('left', wd); // 图片懒加载250427 $('.as-tpl-hm-banner01').find('img').trigger('appear'); }, }, }); //乾崑车载云 轮播二 var mySwiper2 = new Swiper('.as-tpl-hm-banner02', { loop: false, pagination: { el: '.swiper-pagination02', clickable: true, renderBullet: function (index, className) { switch (index) { case 0: text = '极致体验'; break; case 1: text = '贴心服务'; break; case 2: text = '安全可靠'; break; case 3: text = ''; break; case 4: text = ''; break; } return ( // '' + text + "" ; '' + text + '' ); }, }, navigation: { nextEl: '.swiper-button-next02', prevEl: '.swiper-button-prev02', }, slidesPerView: 1, loop: false, autoplay: false, spaceBetween: 4, keyboard: true, observer: true, observeParents: true, on: { transitionStart: function (mySwiper2) { var sliderwidth = $('.ias-tpl-hm-section03-02 .swiper-pagination-bullet').outerWidth(); var allwidth = sliderwidth * this.activeIndex; var wd = allwidth + 'px'; $('.ias-tpl-hm-section03-02 .ias-tpl-hm-tool .ias-tpl-pagination-bg').css('left', wd); // 图片懒加载250427 $('.as-tpl-hm-banner02').find('img').trigger('appear'); }, }, }); //乾崑智驾 轮播三 var mySwiper2 = new Swiper('.as-tpl-hm-banner03', { loop: false, pagination: { el: '.swiper-pagination03', clickable: true, renderBullet: function (index, className) { switch (index) { case 0: text = '华为乾崑智驾 ADS 4'; break; case 1: text = '架构升级'; break; case 2: text = '安全升级'; break; case 3: text = '体验升级'; break; case 4: text = '产业升级'; break; } return ( // '' + text + "" ; '' + text + '' ); }, }, navigation: { nextEl: '.swiper-button-next03', prevEl: '.swiper-button-prev03', }, slidesPerView: 1, loop: false, autoplay: false, spaceBetween: 4, keyboard: true, observer: true, observeParents: true, on: { transitionStart: function (mySwiper2) { var sliderwidth = $('.ias-tpl-hm-section03-03 .swiper-pagination-bullet').width(); var allwidth = sliderwidth * this.activeIndex; var wd = allwidth + 'px'; $('.ias-tpl-hm-section03-03 .ias-tpl-hm-tool .ias-tpl-pagination-bg').css('left', wd); // 图片懒加载250427 $('.as-tpl-hm-banner03').find('img').trigger('appear'); }, }, }); //乾崑座舱 轮播四 var mySwiper2 = new Swiper('.as-tpl-hm-banner04', { loop: false, pagination: { el: '.swiper-pagination04', clickable: true, renderBullet: function (index, className) { switch (index) { case 0: text = 'HarmonySpace 5 鸿蒙座舱车机操作系统'; break; case 1: text = 'HUAWEI SOUND 非凡系列'; break; case 2: text = '16.1 英寸华为车载智慧屏'; break; case 3: text = '移动的第三生活空间'; break; case 4: text = ''; break; } return ( // '' + text + "" ; '' + text + '' ); }, }, navigation: { nextEl: '.swiper-button-next04', prevEl: '.swiper-button-prev04', }, slidesPerView: 1, loop: false, autoplay: false, spaceBetween: 4, keyboard: true, observer: true, observeParents: true, on: { transitionStart: function (mySwiper2) { var sliderwidth = $('.ias-tpl-hm-section04-04 .swiper-pagination-bullet').width(); var allwidth = sliderwidth * this.activeIndex; var wd = allwidth + 'px'; $('.ias-tpl-hm-section04-04 .ias-tpl-hm-tool .ias-tpl-pagination-bg').css('left', wd); // 图片懒加载250427 $('.as-tpl-hm-banner04').find('img').trigger('appear'); }, }, }); //乾崑车载光 轮播五 var mySwiper2 = new Swiper('.as-tpl-hm-banner05', { loop: false, pagination: { el: '.swiper-pagination05', clickable: true, renderBullet: function (index, className) { switch (index) { case 0: text = 'ADB 精准遮蔽'; break; case 1: text = '雨雾安全增强'; break; case 2: text = '盲区预警'; break; case 3: text = ''; break; case 4: text = ''; break; } return ( // '' + text + "" ; '' + text + '' ); }, }, navigation: { nextEl: '.swiper-button-next05', prevEl: '.swiper-button-prev05', }, slidesPerView: 1, loop: false, autoplay: false, spaceBetween: 4, keyboard: true, observer: true, observeParents: true, on: { transitionStart: function (mySwiper2) { var sliderwidth = $('.ias-tpl-hm-section05-05 .swiper-pagination-bullet').width(); var allwidth = sliderwidth * this.activeIndex; var wd = allwidth + 'px'; $('.ias-tpl-hm-section05-05 .ias-tpl-hm-tool .ias-tpl-pagination-bg').css('left', wd); // 图片懒加载250427 $('.as-tpl-hm-banner05').find('img').trigger('appear'); }, }, }); function resizetab() { setTimeout(function () { var tabwidth = $('.ias-car-partner-tab-list li.active').outerWidth() + 'px'; $('.ias-car-partner-tab-con .bg').css('width', tabwidth); var allwidth = 0; $('.ias-car-partner-tab-list li').each(function (i) { allwidth += $('.ias-car-partner-tab-list li').eq(i).outerWidth(); var wd = $(this).outerWidth(); var activewd = allwidth - wd + 'px'; $(this).on('click', function () { $(this).addClass('active').siblings().removeClass('active'); $('.ias-car-partner-tab-con .bg').css({ width: wd, left: activewd }); $('.ias-car-partner-item') .eq(i) .show() .addClass('on') .siblings() .hide() .removeClass('on'); // 图片懒加载250427 $('.ias-car-partner-con').find('img').trigger('appear'); if ($(this).text() == '奥迪') { $('.aodi-tip p ').css('opacity', '1'); } else { $('.aodi-tip p ').css('opacity', '0'); } }); }); }, 500); } resizetab(); // $(window).resize(function () { // resizetab(); // }); $('.ias-car-partner-tab-con h4').on('click', function (e) { e.stopPropagation(); if ($('.ias-car-partner-tab-list').hasClass('active')) { $(this).next().removeClass('active'); } else { $(this).next().addClass('active'); } }); $(document).on('click', function (e) { e.stopPropagation(); $('.ias-car-partner-tab-list').removeClass('active'); }); // 合作车型 图片(2)块2 var mySwiper = new Swiper('.ias-partner-banner-mob02', { // direction: "vertical", loop: false, pagination: { el: '.swiper-paginationmob02', clickable: true, }, navigation: { nextEl: '.swiper-button-nextmob02', prevEl: '.swiper-button-prevmob02', }, slidesPerView: 1, speed: 500, loop: false, autoplay: false, spaceBetween: 4, keyboard: true, observer: true, observeParents: true, }); // 合作车型传祺 图片(2)块2 var mySwiper = new Swiper('.ias-partner-banner-mob04', { // direction: "vertical", loop: false, pagination: { el: '.swiper-paginationmob04', clickable: true, }, navigation: { nextEl: '.swiper-button-nextmob04', prevEl: '.swiper-button-prevmob04', }, slidesPerView: 1, speed: 500, loop: false, autoplay: false, spaceBetween: 4, keyboard: true, observer: true, observeParents: true, }); // 合作车型享界 图片(2)块2 var mySwiper = new Swiper('.ias-partner-banner-mob05', { // direction: "vertical", loop: false, pagination: { el: '.swiper-paginationmob05', clickable: true, }, navigation: { nextEl: '.swiper-button-nextmob05', prevEl: '.swiper-button-prevmob05', }, slidesPerView: 1, speed: 500, loop: false, autoplay: false, spaceBetween: 4, keyboard: true, observer: true, observeParents: true, }); // 岚图梦想家 图片(2)块2 var mySwiper = new Swiper('.ias-partner-banner-lantu', { // direction: "vertical", loop: false, pagination: { el: '.swiper-pagination-lantu', clickable: true, }, navigation: { nextEl: '.swiper-button-next-lantu', prevEl: '.swiper-button-prev-lantu', }, slidesPerView: 1, speed: 500, loop: false, autoplay: false, spaceBetween: 4, keyboard: true, observer: true, observeParents: true, }); // 合作车型 图片(2)块2 深蓝 var mySwiper = new Swiper('.ias-partner-banner-mob02-deepal', { // direction: "vertical", loop: false, pagination: { el: '.swiper-paginationmob02-deepal', clickable: true, }, navigation: { nextEl: '.swiper-button-nextmob02-deepal', prevEl: '.swiper-button-prevmob02-deepal', }, slidesPerView: 1, speed: 500, loop: false, autoplay: false, spaceBetween: 4, keyboard: true, observer: true, observeParents: true, }); // 奥迪合作车型 图片块 3 var mySwiper = new Swiper('.ias-partner-banner-aodi', { // direction: "vertical", loop: false, pagination: { el: '.swiper-paginationaodi', clickable: true, }, navigation: { nextEl: '.swiper-button-nextaodi', prevEl: '.swiper-button-prevaodi', }, slidesPerView: 1, speed: 500, loop: false, autoplay: false, spaceBetween: 4, keyboard: true, observer: true, observeParents: true, }); var mySwiper = new Swiper('.ias-partner-banner-mob02_250312', { // direction: "vertical", loop: false, pagination: { el: '.swiper-paginationmob02_250312', clickable: true, }, navigation: { nextEl: '.swiper-button-nextmob02_250312', prevEl: '.swiper-button-prevmob02_250312', }, slidesPerView: 1, speed: 500, loop: false, autoplay: false, spaceBetween: 4, keyboard: true, observer: true, observeParents: true, }); // 合作车型 图片(3)块3 var mySwiper = new Swiper('.ias-partner-banner-mob03', { // direction: "vertical", loop: false, pagination: { el: '.swiper-paginationmob03', clickable: true, }, navigation: { nextEl: '.swiper-button-nextmob03', prevEl: '.swiper-button-prevmob03', }, slidesPerView: 1, speed: 500, loop: false, autoplay: false, spaceBetween: 4, keyboard: true, observer: true, observeParents: true, breakpoints: { 900: { slidesPerView: 4, spaceBetween: 20, }, }, }); // 合作车型 图片(4)块4 var mySwiper = new Swiper('.ias-partner-banner4', { // direction: "vertical", loop: false, pagination: { el: '.swiper-pagination4', clickable: true, }, navigation: { nextEl: '.swiper-button-next4', prevEl: '.swiper-button-prev4', }, slidesPerView: 1, speed: 500, loop: false, autoplay: false, spaceBetween: 4, keyboard: true, observer: true, observeParents: true, breakpoints: { 900: { slidesPerView: 4, spaceBetween: 20, }, }, }); // 合作车型 图片(4)块4 var mySwiper = new Swiper('.ias-partner-banner5', { // direction: "vertical", loop: false, pagination: { el: '.swiper-pagination5', clickable: true, }, navigation: { nextEl: '.swiper-button-next5', prevEl: '.swiper-button-prev5', }, slidesPerView: 1, speed: 500, loop: false, autoplay: false, spaceBetween: 4, keyboard: true, observer: true, observeParents: true, breakpoints: { 900: { slidesPerView: 4, spaceBetween: 20, }, }, }); // 合作车型 问界图片(4)块4 var mySwiper = new Swiper('.ias-partner-banner-wenjie', { // direction: "vertical", loop: false, pagination: { el: '.swiper-pagination-wenjie', clickable: true, }, navigation: { nextEl: '.swiper-button-next-wenjie', prevEl: '.swiper-button-prev-wenjie', }, slidesPerView: 1, speed: 500, loop: false, autoplay: false, spaceBetween: 4, keyboard: true, observer: true, observeParents: true, breakpoints: { 900: { slidesPerView: 4, spaceBetween: 20, }, }, on: { transitionStart: function (mySwiper) { // 图片懒加载250427 $('.ias-partner-banner-wenjie').find('img').trigger('appear'); }, }, }); // 合作车型 奥迪图片(4)块4 var mySwiper = new Swiper('.ias-partner-banner-aodi4', { // direction: "vertical", loop: false, pagination: { el: '.swiper-pagination-aodi4', clickable: true, }, navigation: { nextEl: '.swiper-button-next-aodi4', prevEl: '.swiper-button-prev-aodi4', }, slidesPerView: 1, speed: 500, loop: false, autoplay: false, spaceBetween: 4, keyboard: true, observer: true, observeParents: true, breakpoints: { 900: { slidesPerView: 4, spaceBetween: 20, }, }, on: { transitionStart: function (mySwiper) { // 图片懒加载250427 $('.ias-partner-banner--aodi4').find('img').trigger('appear'); }, }, }); // 合作车型 图片(4)块9 var mySwiper = new Swiper('.ias-partner-banner9', { // direction: "vertical", loop: false, pagination: { el: '.swiper-pagination9', clickable: true, }, navigation: { nextEl: '.swiper-button-next9', prevEl: '.swiper-button-prev9', }, slidesPerView: 4, speed: 500, loop: false, autoplay: false, spaceBetween: 20, keyboard: true, observer: true, observeParents: true, }); // 新闻活动 // var mySwiper = new Swiper('.ias-news-banner-banner01', { // // direction: "vertical", // loop: false, // pagination: { // el: '.swiper-pagination-news01', // type: 'fraction', // }, // navigation: { // nextEl: '.swiper-button-next-news01', // prevEl: '.swiper-button-prev-news01', // }, // slidesPerView: 1, // speed: 500, // loop: false, // autoplay: false, // spaceBetween: 4, // keyboard: true, // observer: true, // observeParents: true, // breakpoints: { // 900: { // slidesPerView: 2, // spaceBetween: 20, // }, // }, // on: { // transitionStart: function (mySwiper) { // // 图片懒加载250427 // $('.ias-news-banner-banner01').find('img').trigger('appear') // }, // }, // }) $('.play_video').click(function () { let videoSrc = $(this).attr('data-video'); $('.popup_box2').addClass('active'); var width = $('.live-show').width(); var height = (width * 9) / 16; $('.live-show').height(height); setTimeout(function () { $('.live-show iframe').attr('src', videoSrc); }, 200); }); $('.popup_box2 .video_close').click(function () { $('.popup_box2').removeClass('active'); $('.live-show iframe').attr('src', ''); }); $('.popup_box2 .popup_bg').click(function () { $('.popup_box2').removeClass('active'); $('.live-show iframe').attr('src', ''); }); // 250317 const scrollButton1 = document.getElementById('wen1'); const section1 = document.getElementById('da1'); scrollButton1.addEventListener('click', () => { section1.scrollIntoView({ block: 'center', behavior: 'smooth' }); section1.classList.add('active'); section2.classList.remove('active'); section3.classList.remove('active'); section4.classList.remove('active'); section5.classList.remove('active'); }); const scrollButton2 = document.getElementById('wen2'); const section2 = document.getElementById('da2'); scrollButton2.addEventListener('click', () => { section2.scrollIntoView({ block: 'center', behavior: 'smooth' }); section2.classList.add('active'); section1.classList.remove('active'); section3.classList.remove('active'); section4.classList.remove('active'); section5.classList.remove('active'); }); const scrollButton2_1 = document.getElementById('wen2_01'); const section2_1 = document.getElementById('da2'); scrollButton2_1.addEventListener('click', () => { section2_1.scrollIntoView({ block: 'center', behavior: 'smooth' }); section2_1.classList.add('active'); section1.classList.remove('active'); section3.classList.remove('active'); section4.classList.remove('active'); section5.classList.remove('active'); }); const scrollButton3 = document.getElementById('wen3'); const section3 = document.getElementById('da3'); scrollButton3.addEventListener('click', () => { section3.scrollIntoView({ block: 'center', behavior: 'smooth' }); section3.classList.add('active'); section1.classList.remove('active'); section2.classList.remove('active'); section4.classList.remove('active'); section5.classList.remove('active'); }); // const scrollButton4 = document.getElementById('wen4'); // const section4 = document.getElementById('da4'); // scrollButton4.addEventListener('click', () => { // section4.scrollIntoView({ block: 'center', behavior: 'smooth' }); // section4.classList.add('active'); // section1.classList.remove('active'); // section2.classList.remove('active'); // section3.classList.remove('active'); // section5.classList.remove('active'); // }); const scrollButton5 = document.getElementById('wen5'); const section5 = document.getElementById('da5'); scrollButton5.addEventListener('click', () => { section5.scrollIntoView({ block: 'center', behavior: 'smooth' }); section5.classList.add('active'); section1.classList.remove('active'); section2.classList.remove('active'); section3.classList.remove('active'); section4.classList.remove('active'); }); // WebP支持检测(首次运行时缓存结果) function checkWebPSupport(callback) { if (typeof localStorage !== 'undefined' && localStorage.getItem('webpSupport') !== null) { return callback(localStorage.getItem('webpSupport') === 'true'); } const img = new Image(); img.onload = function () { const result = img.width > 0 && img.height > 0; localStorage.setItem('webpSupport', result); callback(result); }; img.onerror = function () { localStorage.setItem('webpSupport', false); callback(false); }; img.src = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII='; } checkWebPSupport(function (isSupported) { $('img').each(function () { const $img = $(this); let webpSrc = $img.closest('picture').find('source[type="image/webp"]').data('srcset'); const webpSrcMob = $img .closest('picture') .find('source[type="image/webp"][media*="max-width: 768px"]') .data('srcset'); if ($(window).width() < 900) { if (webpSrcMob != undefined) { webpSrc = webpSrcMob; } } const fallbackSrc = $img.data('src'); // 动态设置真实图片路径 $img.data('original', isSupported ? webpSrc : fallbackSrc); }); $('img').lazyload({ threshold: 200, effect: 'fadeIn', appear: function () { const realSrc = $(this).data('original'); $(this).attr('src', realSrc); $(this).addClass('lazy-loaded'); }, load: function () { $(this).addClass('lazy-loaded'); }, error: function () { $(this).attr('src', 'img/error.jpg'); }, }); }); // 初始化懒加载 $('img').lazyload({ effect: 'fadeIn', // 淡入效果 threshold: 100, // 提前300px加载 failure_limit: 15, // 最大容错数量 skip_invisible: true, // 加载隐藏图片 appear: function () { // 加载前回调 let _this = $(this); if (_this.data('original') != undefined) { _this.on('load', function () { _this.css('background', 'transparent'); _this.removeClass('lazyload'); $('.kv-text').removeClass('lazy-text'); $('.kv-txt-chewei').removeClass('lazy-text'); $('.kv-ads-txt').removeClass('lazy-text'); mySwiperKv.autoplay.start(); }); } }, load: function () { // 加载完成回调 $(this).addClass('lazy-loaded'); }, }); // 20250829 $('.kv-swiper1 .ias-tpl-play-icon').click(function () { $('.video-box').first().addClass('kv-vd'); }); $('.ias-mobile-tpl-header-nav-item:nth-child(5)').click(function () { $('body').removeClass('ias-tpl-overflow-hidden'); $('.ias-mobile-header-menu').removeClass('ias-mobile-header-menu-active'); $('.ias-mobile-tpl-header-nav-list').removeClass('ias-mobile-tpl-header-nav-list-active'); }); });