var $w = $(window).width(); var CU = { scrollDiy: function () { $(".top-cont,.yichan-conts,.gy-desc").mCustomScrollbar({ scrollButtons: { enable: false } }); var len = $(".yichan-center .links").length; $(".yichan-center .links").eq(0).addClass("link-sel"); $(".yichan-center .links").each(function (index) { $(this).on("click", function () { if (index == len - 1) { $(".yichan-conts").addClass("yichan-pad"); $(".yichan-center .sons").show(); $(".yichan-center .links").removeClass("link-sel"); $(".yichan-center .links").eq(index).addClass("link-sel"); $(".sons-href").eq(0).trigger("click"); } else { $(".yichan-center .sons").hide(); $(".yichan-conts").removeClass("yichan-pad"); $(".yichan-center .links").removeClass("link-sel"); $(".yichan-center .links").eq(index).addClass("link-sel"); $(".yichan-center .list").hide(); $(".yichan-center .list").eq(index).show(); } }); }); $(".sons-href").each(function (index) { $(this).on("click", function () { $(".yichan-center .sons-href").removeClass("sons-sel"); $(".yichan-center .sons-href").eq(index).addClass("sons-sel"); $(".yichan-center .list").hide(); $(".yichan-center .son-list").eq(index).show(); }); }); $(".pp-top .items").eq(0).addClass("item-sel"); $(".pp-top .items .pic").eq(0).show(); $(".pp-top .items .desc").eq(0).show(); $(".pp-top .items").each(function (index) { $(this).on("click", function () { $(".pp-top .items").removeClass("item-sel"); $(".pp-top .items").eq(index).addClass("item-sel"); $(".pp-top .items .desc").hide(); $(".pp-top .items .desc").eq(index).show(); $(".pp-top .items .pic").hide(); $(".pp-top .items .pic").eq(index).show(); }); }); }, popleChange: function (tar) { if (tar && tar.length != 0) { tar.eq(0).addClass("namesel"); tar.each(function (index) { $(this).on("click", function () { tar.removeClass("namesel"); tar.eq(index).addClass("namesel"); $(".famous .left .item").hide(); $(".famous .left .item").eq(index).show(); }); }); } }, yichanChange: function (tar) { if (tar && tar.length != 0) { var $topnum = 3 if($w<=750){ $topnum = 1 } tar.eq(0).addClass("top-tabs-sel"); $(".top-wraps").eq(0).addClass("top-wraps-show"); var mySwiperPic = new Swiper('.top-swiper0', { slidesPerView: $topnum, loop:true, spaceBetween: 20, // 濡傛灉闇€瑕佸墠杩涘悗閫€鎸夐挳 navigation: { nextEl: '.swiper-top-next0', prevEl: '.swiper-top-prev0', } }); tar.each(function (index) { $(this).on("click", function () { tar.removeClass("top-tabs-sel"); tar.eq(index).addClass("top-tabs-sel"); $(".top-wraps").removeClass("top-wraps-show"); $(".top-wraps").eq(index).addClass("top-wraps-show"); if (index == 0) { var mySwiperPic = new Swiper('.top-swiper0', { slidesPerView: $topnum, loop:true, spaceBetween: 20, // 濡傛灉闇€瑕佸墠杩涘悗閫€鎸夐挳 navigation: { nextEl: '.swiper-top-next0', prevEl: '.swiper-top-prev0', } }); } else { var mySwiperPic = new Swiper('.top-swiper1', { slidesPerView: $topnum, loop:true, spaceBetween: 20, // 濡傛灉闇€瑕佸墠杩涘悗閫€鎸夐挳 navigation: { nextEl: '.swiper-top-next1', prevEl: '.swiper-top-prev1', } }); } }); }); } }, bbSwiper: function (tar) { var $num = 5 if($w<=750){ $num = 3 } var mySwiper = new Swiper(".bb-swiper-main", { slidesPerView: $num, spaceBetween: 20, // 濡傛灉闇€瑕佸墠杩涘悗閫€鎸夐挳 }); var num = 0; $(".bb-wrap").removeClass("bb-sel"); $(".bb-wrap").eq(num).addClass("bb-sel"); $(".intro-cont .items").eq(0).show(); if (num == 0) { $(".swiper-bb-prev").addClass("bb-dis"); } $(".swiper-bb-prev").on("click", function () { $(".swiper-bb-next").removeClass("bb-dis"); if (num <= 0) { num = 0; $(".swiper-bb-prev").addClass("bb-dis"); mySwiper.slideTo(0); return false; } else { if (num == 1) { $(".swiper-bb-prev").addClass("bb-dis"); } mySwiper.slidePrev(); } num--; $(".bb-wrap").removeClass("bb-sel"); $(".bb-wrap").eq(num).addClass("bb-sel"); $(".intro-cont .items").hide(); $(".intro-cont .items").eq(num).show(); }); $(".swiper-bb-next").on("click", function () { $(".swiper-bb-prev").removeClass("bb-dis"); if (num >= $(".bb-wrap").length-1) { $(".swiper-bb-next").addClass("bb-dis"); return false; } else { if (num >= $(".bb-wrap").length-2) { $(".swiper-bb-next").addClass("bb-dis"); } mySwiper.slideNext(); } num++; $(".bb-wrap").removeClass("bb-sel"); $(".bb-wrap").eq(num).addClass("bb-sel"); $(".intro-cont .items").hide(); $(".intro-cont .items").eq(num).show(); }); $(".bb-wrap").each(function (index) { $(this).on("click", function () { $(".bb-wrap").removeClass("bb-sel"); $(".bb-wrap").eq(index).addClass("bb-sel"); $(".intro-cont .items").hide(); $(".intro-cont .items").eq(index).show(); num = index; if (index == 0) { $(".swiper-bb-next").removeClass("bb-dis"); $(".swiper-bb-prev").addClass("bb-dis"); } else if (index == $(".bb-wrap").length - 1) { $(".swiper-bb-prev").removeClass("bb-dis"); $(".swiper-bb-next").addClass("bb-dis"); } else { $(".swiper-bb-prev").removeClass("bb-dis"); $(".swiper-bb-next").removeClass("bb-dis"); } }); }); }, jkSwiper: function (tar) { if (tar && tar.length != 0) { var mySwiper = new Swiper(".jk-swiper", { slidesPerView: 3, spaceBetween: 20, breakpoints: { 300: { slidesPerView: 'auto', centeredSlides: true, centeredSlidesBounds: true, loop:true, }, 750: { slidesPerView: 3, } }, navigation: { nextEl: '.swiper-jk-next', prevEl: '.swiper-jk-prev', }, }); } }, hisSwiper: function (tar) { if (tar && tar.length != 0) { var mySwiper = new Swiper('.his-swiper', { direction: 'vertical', // 鍨傜洿鍒囨崲閫夐」 slidesPerView: 6, loop: false, // 寰幆妯″紡閫夐」 }); var num = 0; $(".history .item").each(function (index) { $(".history .item").eq(index).attr("data-offset", ($(".history .item").eq(index).offset()).top); $(".his-swiper .age").eq(index).attr("data-offset", ($(".history .item").eq(index).offset()).top); }); var scrollTop = $(document).scrollTop(), curDom = $(".history .item"), offsetHeight = $(document).height(),winH = $(window).height(); if (scrollTop >= 1300&&(scrollTop+winH+500) curDom.eq(i).attr("data-offset")-250) { $(".his-swiper .age").removeClass("age-sel"); $(".his-swiper .age").eq(i).addClass("age-sel"); mySwiper.slideTo(i); num = i; } } $(window).scroll(function (event) { var scrollTop = $(document).scrollTop(), curDom = $(".history .item"); if (scrollTop >= 1200&&(scrollTop+winH+500) curDom.eq(i).attr("data-offset")-350) { $(".his-swiper .age").removeClass("age-sel"); $(".his-swiper .age").eq(i).addClass("age-sel"); mySwiper.slideTo(i); } } }); $(".his-swiper .age").each(function (index) { $(this).on("click", function () { $(".his-swiper .age").removeClass("age-sel"); $(".his-swiper .age").eq(index).addClass("age-sel"); mySwiper.slideTo(index); num = index; $("body,html").stop().animate({ scrollTop: $(this).attr("data-offset")-120 }); }); }); var a = $(".his-swiper .age"); $(".his-swiper .age").removeClass("age-sel"); $(".his-swiper .age").eq(num).addClass("age-sel"); if (num == 0) { $(".swiper-his-prev").addClass("his-dis"); } $(".swiper-his-prev").on("click", function () { $(".swiper-his-next").removeClass("his-dis"); if (num <= 0) { num = 0; $(".swiper-his-prev").addClass("his-dis"); mySwiper.slideTo(0); return false; } else { if (num == 1) { $(".swiper-his-prev").addClass("bb-dis"); } mySwiper.slidePrev(); } num--; $(".his-swiper .age").removeClass("age-sel"); $(".his-swiper .age").eq(num).addClass("age-sel"); $(".his-swiper .age").eq(num).trigger("click"); }); $(".swiper-his-next").on("click", function () { $(".swiper-his-prev").removeClass("his-dis"); if (num >= $(".his-swiper .age").length-1) { $(".swiper-his-next").addClass("his-dis"); return false; } else { if (num >= $(".his-swiper .age").length-2) { $(".swiper-his-next").addClass("his-dis"); } mySwiper.slideNext(); } num++; $(".his-swiper .age").removeClass("age-sel"); $(".his-swiper .age").eq(num).addClass("age-sel"); $(".his-swiper .age").eq(num).trigger("click"); }); $(".history .pic-item").on("click", function () { $(".fj-mask,.fj-swiper-open").show(); var mySwiper4 = new Swiper('.fj-swiper-open-main', { loop: false, effect: 'fade', fadeEffect: { crossFade: true, }, on: { }, pagination: { el: '.swiper-wh-pagination', type: 'fraction' }, }); var slides = ($(this).find(".swiper-slide")).clone(); mySwiper4.removeAllSlides(); mySwiper4.appendSlide(slides); $(".swiper-open-next").on("click", function () { mySwiper4.slideNext(); }); $(".swiper-open-prev").on("click", function () { mySwiper4.slidePrev(); }); }); $(".fj-open-close,.fj-mask").on("click", function () { $(".fj-mask,.fj-swiper-open").hide(); }); } }, hisSwiperMob: function (tar) { if (tar && tar.length != 0) { var mySwiper = new Swiper('.his-swiper-mob', { slidesPerView: 'auto', spaceBetween:30, loop: false, // 寰幆妯″紡閫夐」 }); $(".history .right .item").each(function (index) { $(".his-swiper-mob .age").eq(index).attr("data-offset", ($(".history .right .item").eq(index).offset()).top); }); $(".his-swiper-mob .age").eq(0).addClass("age-sel"); $(".his-swiper-mob .age").each(function (index) { $(this).on("click", function () { $(".his-swiper-mob .age").removeClass("age-sel"); $(".his-swiper-mob .age").eq(index).addClass("age-sel"); $("body,html").stop().animate({ scrollTop: $(this).attr("data-offset")-340 }); }); }); $(window).scroll(function (event) { var scrollTop = $(document).scrollTop(), curDom = $(".history .item"), offsetHeight = $(document).height(), winH = $(window).height(); if (scrollTop >= 900) { $(".left-mob").addClass("left-mob-sel"); } else { $(".left-mob").removeClass("left-mob-sel"); } }); } }, gySwiper: function (tar) { if (tar && tar.length != 0) { var swiper = new Swiper(".gy-swiper-thum", { spaceBetween: 15, slidesPerView: 'auto', breakpoints: { 300: { slidesPerView: 'auto', }, 750: { slidesPerView: 'auto', }, 1180: { slidesPerView: 6, } }, watchSlidesProgress: true, }); var swiper2 = new Swiper(".gy-swiper-all", { spaceBetween: 10, navigation: { nextEl: ".swiper-button-next-big", prevEl: ".swiper-button-prev-big", }, loop:true, thumbs: { swiper: swiper, }, on: { init: function () { CU.smallSwiper($(".gy-swiper-sm").eq(0), 0); }, slideChange: function () { CU.smallSwiper($(".gy-swiper-sm").eq(this.activeIndex), this.activeIndex); }, } }); } }, smallSwiper: function (tar, index) { var swiper = new Swiper(tar, { loop:true, navigation: { nextEl: ".swiper-button-next-in"+index, prevEl: ".swiper-button-prev-in"+index, }, pagination: { el: '.small-pagination'+index, type: 'fraction', }, on: { init: function () { if (this.slides.length == 3) { $(".swiper-button-prev-in"+index+",.swiper-button-next-in"+index).hide(); this.allowTouchMove = false; } } } }); } } function cuInit() { CU.scrollDiy(); CU.popleChange($(".names")); CU.yichanChange($(".top-tabs-href")); CU.bbSwiper($(".bb-swiper-main")); CU.jkSwiper($(".jk-swiper")); CU.hisSwiper($(".his-swiper")); CU.hisSwiperMob($(".left-mob")); CU.gySwiper($(".gy-swiper-top")); } $(function () { cuInit(); });