var wid = $("body,html").width() //鎵嬫満瀵艰埅toggle function phoneNavToggle(obj) { $(obj).toggleClass("on") $("#phone-nav").fadeToggle(300) $(".header-wrapper .search-box").removeClass("on") $(".search-form").hide() $(".header-wrapper").toggleClass("active") } $(".num span").countUp() $(".phone-nav li > a").click(function(){ $(".phone-nav ul li").removeClass("on") $(this).parent("li").toggleClass("active").siblings().removeClass("active"); $(this).next(".nav").slideToggle(500).parent().siblings().find(".nav").slideUp(500) }) $(window).on("scroll", function(){ var top = $(window).scrollTop(); if(top > 100) { $(".gotop").fadeIn(600) }else{ $(".gotop").fadeOut(600) } if(wid < 1024) { if(top > 100) { $(".header-wrapper .search-box").removeClass("on") $(".header-wrapper").removeClass("on") $(".header-wrapper").removeClass("active") $(".search-form").fadeOut() $(".phone-nav").fadeOut() $(".nav-icon").removeClass("on") } } }) function searchToggle(){ $(".header-wrapper .search-box").toggleClass("on") $(".search-form").slideToggle(500) $(".nav-icon").removeClass("on") $(".header-wrapper").removeClass("active") $("#phone-nav").fadeOut(300) } // 鎵嬫満鍥炲埌椤堕儴 function gotop() { $("body,html").animate({ scrollTop: 0 }, 800); } function itemToggle(obj) { $(obj).toggleClass("extend") $(obj).next(".nav").slideToggle(500) $(".page-nav-box .nav .cat").removeClass("active") $(".page-nav-box .nav .child").hide() } $(function(){ if ($(".wow").length) { if (!(/msie [6|7|8|9]/i.test(navigator.userAgent))) { var wow = new WOW({ boxClass: 'wow', animateClass: 'animated', offset: 50, mobile: true, live: true }); wow.init(); }; } }) if(wid < 1024) { $(".header-wrapper .search-box").click(function(){ $(".header-wrapper .search-box").toggleClass("on") $(".search-form").slideToggle(500) $(".nav-icon").removeClass("on") $(".header-wrapper").toggleClass("on") $("#phone-nav").fadeOut(300) }) } function makesvg(percentage){ var abs_percentage=Math.abs(percentage).toString(); var percentage_str=percentage.toString(); var svg = '' + '' + '' + ''; return svg } // banner 杞挱 var index_banner = new Swiper('.index-banner-swiper', { navigation: { nextEl: '.index-banner-wrapper .next', prevEl: '.index-banner-wrapper .prev', }, pagination: { el: '.index-banner-swiper .swiper-pagination', clickable: true, }, autoplay: { autoplay: 3000, disableOnInteraction: false, }, loop: true, speed: 1200, on: { init: function(){ setTimeout(function(){ $('.index-banner-swiper').find('.swiper-pagination').find('.swiper-pagination-bullet').append('
'); var p = $('.index-banner-swiper').find('.swiper-pagination').find('.swiper-pagination-bullet .circlechart').attr('data-percentage'); $('.index-banner-swiper').find('.swiper-pagination').find('.swiper-pagination-bullet .circlechart').html( makesvg(p)) $('.index-banner-swiper').find('.swiper-pagination').find('.swiper-pagination-bullet').eq(0).addClass('one') },100) }, } }) $(".index-banner-wrapper").hover(function(){ index_banner.autoplay.stop() },function(){ index_banner.autoplay.start() }) var index_goods_swiper = new Swiper('.index-goods-swiper', { navigation: { nextEl: '.index-box-2 .next', prevEl: '.index-box-2 .prev', }, speed: 1200, effect: "fade" }) var index_news_swiper = new Swiper('.index-news-swiper', { navigation: { nextEl: '.index-box-3 .next', prevEl: '.index-box-3 .prev', }, slidesPerView: 3, spaceBetween: 60, // autoplay: { // autoplay: 3000, // disableOnInteraction: false, // }, loop: true, speed: 1200, breakpoints: { 1600: { spaceBetween: 50, }, 1440: { spaceBetween: 40, }, 1366: { spaceBetween: 36, }, 1024: { slidesPerView: 1, spaceBetween: 0, } }, speed: 1200, }) $(".index-news-swiper").hover(function(){ index_news_swiper.autoplay.stop() },function(){ index_news_swiper.autoplay.start() }) if(wid > 1024) { var index_thumb_swiper = new Swiper('.index-thumb-swiper', { slidesPerView: 4, spaceBetween: 52, breakpoints: { 1600: { spaceBetween: 46, }, 1440: { spaceBetween: 40, }, 1366: { spaceBetween: 36, }, 1280: { spaceBetween: 20, }, 1024: { slidesPerView: 3, spaceBetween: 0, } }, speed: 1200, on: { init: function(){ $(".index-thumb-swiper .swiper-slide").eq(this.activeIndex).addClass("on") index_goods_swiper.slideTo(this.activeIndex) }, slideChangeTransitionStart: function () { $(".index-thumb-swiper .swiper-slide").eq(this.activeIndex).addClass("on").siblings().removeClass("on"); index_goods_swiper.slideTo(this.activeIndex) }, // click: function () { // $(".index-thumb-swiper .swiper-slide").eq(this.clickedIndex).addClass("on").siblings().removeClass("on"); // index_goods_swiper.slideTo(this.clickedIndex) // }, }, }) $(".index-thumb-swiper .swiper-slide").hover(function(){ $(this).addClass("on").siblings().removeClass("on"); index_goods_swiper.slideTo($(this).index()) }) $(".index-box-2 .prev").click(function(){ var active_index = $(".index-thumb-swiper .swiper-slide.on").index() if(active_index > 0) { index_thumb_swiper.slideTo(active_index-1) index_goods_swiper.slideTo(active_index-1) $('.index-thumb-swiper .swiper-slide').eq(active_index-1).addClass('on').siblings().removeClass("on"); } }) $(".index-box-2 .next").click(function(){ var len = $(".index-thumb-swiper .swiper-slide").length var index = $(".index-thumb-swiper .swiper-slide.on").index() if(index >= 0 && index < len) { index_thumb_swiper.slideTo(index+1) index_goods_swiper.slideTo(index+1) $('.index-thumb-swiper .swiper-slide').eq(index+1).addClass('on').siblings().removeClass("on"); } }) }else{ $(".index-box-1 .data ul li").each(function(i){ $(this).addClass("wow fadeInUp50").attr("data-wow-delay",(i+2)*100+"ms") }) $(".index-box-4 .data ul li").each(function(i){ $(this).addClass("wow fadeInUp50").attr("data-wow-delay",i*80+"ms") }) $(".index-box-1 .pic,.index-box-1 .about").addClass("wow fadeInUp50") $(".index-box-2 .index-title,.index-box-2 .thumb-box,.index-box-2 .swiper-box").addClass("wow fadeInUp50") $(".index-box-3 .index-title,.index-box-3 .index-more,.index-box-3 .swiper-box").addClass("wow fadeInUp50") $(".index-box-4 .index-title,.index-box-4 .main").addClass("wow fadeInUp50") $(".page-nav-box .nav .cat").each(function(){ var childLen = $(this).next(".child").find("a").length if(childLen>0) { $(this).attr("href","javascrit:;") $(this).click(function(){ $(this).toggleClass("active").siblings().removeClass("active") $(this).next(".child").slideToggle(300).siblings(".child").slideUp() }) } }) } if(wid < 1024) { $(".friend-link .caption").click(function(){ $(".friend-link").toggleClass("on") $(".friend-link .list").stop().slideToggle(300) }) }else{ $(".friend-link").hover(function(){ $(".friend-link .list").stop().slideToggle(300) }) var index_swiper = new Swiper('.index-swiper', { pagination: { el: '.index-swiper-pagination', clickable: true, }, direction : 'vertical', mousewheel: true, speed: 1200, keyboardControl: true, mousewheelControl: true, slidesPerView: 'auto', paginationClickable:true, on: { init: function() { setTimeout(function(){ $('.index-swiper-pagination').find('.swiper-pagination-bullet').append('
'); var p = $('.index-swiper-pagination').find('.swiper-pagination-bullet .circlechart').attr('data-percentage'); $('.index-swiper-pagination').find('.swiper-pagination-bullet .circlechart').html( makesvg(p)) $('.index-swiper-pagination').find('.swiper-pagination-bullet').eq(0).addClass('one') },100) }, slideChangeTransitionStart: function(){ var cur_i = this.activeIndex if(cur_i == 1 || cur_i == 3 || cur_i == 4) { $(".index-swiper-pagination").addClass("on") }else{ $(".index-swiper-pagination").removeClass("on") } if(cur_i == 3) { index_news_swiper.autoplay.start() } }, slideChangeTransitionEnd: function(){ $(".num span").countUp() console.log(1) }, transitionStart: function(){ if (this.progress === 1) { $(".index-swiper-pagination").fadeOut() $(".header-wrapper").fadeOut() }else{ $(".header-wrapper").fadeIn() $(".index-swiper-pagination").fadeIn() } }, }, }) }