diff --git a/assets/js/script.js b/assets/js/script.js index fc7c030..facb5da 100644 --- a/assets/js/script.js +++ b/assets/js/script.js @@ -216,24 +216,57 @@ // HERO SLIDER - if (typeof Swiper === "function" && jQuery(".hero-slider .swiper-container").length) { + var heroSwiper = null; + var heroSlideCount = 0; + var heroAutoplayOptions = { + delay: 6500, + disableOnInteraction: false, + stopOnLastSlide: false + }; + + function applyHeroInterleave(swiper) { + if (!swiper || !swiper.slides) { + return; + } + + var interleaveOffset = getHeroInterleaveOffset(); + var innerOffset = (swiper.width || 0) * interleaveOffset; + + for (var i = 0; i < swiper.slides.length; i++) { + var slideProgress = Math.max(Math.min(swiper.slides[i].progress || 0, 1), -1); + var innerTranslate = slideProgress * innerOffset; + var slideInner = swiper.slides[i].querySelector(".slide-inner"); + + if (slideInner) { + slideInner.style.transform = + "translate3d(" + innerTranslate + "px, 0, 0)"; + } + } + } + + function initHeroSlider() { + if (heroSwiper) { + return heroSwiper; + } + + if (typeof Swiper !== "function" || !jQuery(".hero-slider .swiper-container").length) { + return null; + } + var $heroSlider = jQuery(".hero-slider .swiper-container"); - var menu = []; - $heroSlider.find('.swiper-slide').each( function(index){ - menu.push( jQuery(this).find('.slide-inner').attr("data-text") ); - }); var totalSlides = $heroSlider.find(".swiper-slide").length; - var shouldLoop = totalSlides > 2; + var shouldLoop = totalSlides > 1; + + heroSlideCount = totalSlides; + var swiperOptions = { loop: shouldLoop, + initialSlide: 0, preloadImages: true, updateOnImagesReady: true, speed: 1000, parallax: true, - autoplay: totalSlides > 1 ? { - delay: 6500, - disableOnInteraction: false, - } : false, + autoplay: false, watchSlidesProgress: true, pagination: { el: '.swiper-pagination', @@ -246,20 +279,12 @@ }, on: { - progress: function() { - var swiper = this; - var interleaveOffset = getHeroInterleaveOffset(); - for (var i = 0; i < swiper.slides.length; i++) { - var slideProgress = Math.max(Math.min(swiper.slides[i].progress, 1), -1); - var innerOffset = swiper.width * interleaveOffset; - var innerTranslate = slideProgress * innerOffset; - var slideInner = swiper.slides[i].querySelector(".slide-inner"); + init: function() { + applyHeroInterleave(this); + }, - if (slideInner) { - slideInner.style.transform = - "translate3d(" + innerTranslate + "px, 0, 0)"; - } - } + progress: function() { + applyHeroInterleave(this); }, touchStart: function() { @@ -287,15 +312,51 @@ swiperOptions.loopedSlides = totalSlides; } - var swiper = new Swiper(".hero-slider .swiper-container", swiperOptions); + heroSwiper = new Swiper(".hero-slider .swiper-container", swiperOptions); + applyHeroInterleave(heroSwiper); + + return heroSwiper; } - - - - /*------------------------------------------ - = HIDE PRELOADER - -------------------------------------------*/ - function hidePreloader() { + + function resetHeroToFirstSlide() { + if (!heroSwiper) { + return; + } + + if (heroSwiper.params && heroSwiper.params.loop && typeof heroSwiper.slideToLoop === "function") { + heroSwiper.slideToLoop(0, 0, false); + } else if (typeof heroSwiper.slideTo === "function") { + heroSwiper.slideTo(0, 0, false); + } + + if (typeof heroSwiper.updateProgress === "function") { + heroSwiper.updateProgress(); + } + + if (typeof heroSwiper.updateSlidesClasses === "function") { + heroSwiper.updateSlidesClasses(); + } + + applyHeroInterleave(heroSwiper); + } + + function startHeroAutoplay() { + resetHeroToFirstSlide(); + + if (!heroSwiper || heroSlideCount <= 1 || !heroSwiper.autoplay || typeof heroSwiper.autoplay.start !== "function") { + return; + } + + heroSwiper.params.autoplay = $.extend({}, heroAutoplayOptions); + heroSwiper.autoplay.start(); + } + + + + /*------------------------------------------ + = HIDE PRELOADER + -------------------------------------------*/ + function hidePreloader(onHidden) { $('.preloader').delay(100).fadeOut(500, function() { //active wow @@ -303,14 +364,27 @@ wow.init(); } + if (typeof onHidden === "function") { + onHidden(); + } + }); } function preloader() { if($('.preloader').length) { - waitForHeroBackgrounds(hidePreloader); + waitForHeroBackgrounds(function() { + initHeroSlider(); + resetHeroToFirstSlide(); + hidePreloader(startHeroAutoplay); + }); + return; } + + initHeroSlider(); + resetHeroToFirstSlide(); + startHeroAutoplay(); } diff --git a/index.html b/index.html index 92e522e..c413b3a 100644 --- a/index.html +++ b/index.html @@ -17,6 +17,7 @@ + @@ -28,8 +29,6 @@ - - diff --git a/product_full_logistics_chain_cargo_agent.html b/product_full_logistics_chain_cargo_agent.html index c3326f6..3218956 100644 --- a/product_full_logistics_chain_cargo_agent.html +++ b/product_full_logistics_chain_cargo_agent.html @@ -69,9 +69,9 @@
-

岸基全程物流链平台-货运代理系统

+

岸基货运代理系统

- 货运代理系统是全程物流链平台核心产品之一,针对货代业务特点,实现货物委托、提单确认、海关预配、EDI、费用结算等关键环节的高效操作。系统通过 AI 提升单证识别与费用对账能力,帮助企业减少人工处理、提升作业效率。 + 岸基货运代理系统是全程物流链平台核心产品之一,针对货代业务特点,实现货物委托、提单确认、海关预配、EDI、费用结算等关键环节的高效操作。系统通过 AI 提升单证识别与费用对账能力,帮助企业减少人工处理、提升作业效率。