;(function ($, window, document, undefined) {
"use strict";
var wind_w = $(window).width();
var wind_h = $(window).height();
document.body.addEventListener("touchstart", function () {
});
//瀵艰埅
if (wind_w > 1100) {
$(".nav_case > a:not(.link_alone)").on("click.sty", function () {
$(".nav_case > a").removeClass("on");
$(this).addClass("on");
$(this).parents("header").addClass("header_on");
var thisLeft = $(this).position().left;
$(this).parents(".nav_case").siblings(".nav_sed_box").find(".nav_sty_dot").css({
left: thisLeft + "px"
})
});
$(".nav_case > a").on("mouseover", function () {
var thisLeft = $(this).position().left;
$(this).parents(".nav_case").siblings(".nav_sed_box").find(".nav_sty_dot").css({
left: thisLeft + "px"
})
});
$(".nav_case > a").on("mouseout", function () {
var thisLeft = $(".nav_case > a.on").position().left;
$(this).parents(".nav_case").siblings(".nav_sed_box").find(".nav_sty_dot").css({
left: thisLeft + "px"
})
});
//鍏抽棴浜岀骇瀵艰埅
$(document).on("click", function (event) {
var eve = $(event.target);
if (eve.closest(".header_on").length == 0) {
$("header").removeClass("header_on");
} else {
console.log('鐐瑰埌鍏冪礌浜?);
}
});
//鐐瑰嚮鍑烘í瀵艰埅
$(".full-menu_pc").on("click.stl", function () {
$("header").addClass("on");
});
// 婊氬姩鍑烘í鍚戝鑸
$(window).scroll(function () {
var thisScrTop = $(document).scrollTop();
if (thisScrTop >= 5) {
if (!$("header").hasClass("on")) {
$("header").addClass("on");
}
} else {
$("header").removeClass("on");
}
});
//璇█鍒囨崲鏍峰紡
$(".language_box > a").on("click.sty", function () {
if (!$(this).hasClass('on')) {
$(".language_box > a").removeClass('on');
$(this).addClass("on");
}
});
}
//鐐瑰嚮鍑烘í瀵艰埅
// $(".full-menu_m").on("click.stl", function () {
// $("header").addClass("on");
// });
// 绉诲姩绔簩绾у鑸垏鎹
$('.menu-list > a ').on("click.sty", function () {
if ($(this).siblings("div").css("display") == "none") {
$('.menu-list > div').slideUp(500);
$(this).siblings("div").slideDown(500);
}
});
// 鍐呴〉banner 鍏ュ満鍔ㄧ敾
$(".con_banner").addClass("on");
//鍐呴〉banner 妯嚎瀹藉害
// window.onload=function () {
// var lineW = $('.sty_line').parents('.sen_link_box').outerWidth() - $('.sty_line').siblings(".pre_box").outerWidth() - $('.sty_line').siblings('.sen_link_con').outerWidth();
// $('.sty_line').css({
// width: lineW + 'px'
// })
// };
var lineW = $('.sty_line').parents('.sen_link_box').outerWidth(true) - $('.sty_line').siblings(".pre_box").outerWidth(true) - $('.sty_line').siblings('.sen_link_con').outerWidth(true);
$('.sty_line').css({
width: lineW - 1 + 'px'
});
//鍔犲叆鎴戜滑 閫夐」鍗″垏鎹
$(".post_title").on("click.sty", function () {
if ($(this).siblings(".post_condition").css("display") == "none") {
$(this).find('.post_num i').addClass('on');
$(this).siblings(".post_condition").slideDown(500);
} else {
$(this).find('.post_num i').removeClass('on');
$(this).siblings(".post_condition").slideUp(500);
}
});
//浜烘墠鐞嗗康
// var t = false ;
// $('.tal_tab_box > .tal_tab_name').on('mouseenter.sty',function ( e ) {
//
// e.preventDefault();
// e.stopPropagation();
//
// if ( ! t ) {
//
// t = true;
//
// if(!$(this).hasClass('on')){
//
// $(this).addClass("on").siblings(".tal_tab_name").removeClass('on');
// $('.tal_tab_box > .tal_tab_name .tal_tex_info').slideUp(500);
// var thsiIndex = $(this).index();
// $('.tal_img_box > div').removeClass("on").eq(thsiIndex).addClass('on');
// $(this).find('.tal_tex_info').slideDown(500);
//
//
// }
//
// setTimeout( function(){
// t = false;
// }, 500 );
// }
// // $('.tal_tab_box > .tal_tab_name .tal_tex_info').stop();
// });
// $('body').on('mouseenter.sty',function ( e ) {
// t = false;
// //console.log( e );
//
// });
$('.tal_tab_box > .tal_tab_name').on('click.sty', function (e) {
e.preventDefault();
e.stopPropagation();
if (!$(this).hasClass('on')) {
$(this).addClass("on").siblings(".tal_tab_name").removeClass('on');
// $('.tal_tab_box > .tal_tab_name .tal_tex_info').slideUp(500);
var thsiIndex = $(this).index();
$('.tal_img_box > div').removeClass("on").eq(thsiIndex).addClass('on');
// $(this).find('.tal_tex_info').slideDown(500);
}
});
//鍏憡鍙婇€氬嚱
if ($('body').hasClass('heng_box')) {
var detIndex = $(".list_u_img_box a.on").index();
var detLefr = $(".list_u_img_box a.on").position().left;
var detViwWidth = $('.view_box').width();
var aWidth = $(".list_u_img_box a.on").width();
var detNoLenght = Math.floor(detViwWidth / aWidth);
var aLength = $(".list_u_img_box a").length;
if (detIndex < aLength - detNoLenght && !aLength - detNoLenght <= 0) {
$(".list_u_img_box ").css({
left: -detLefr + "px"
});
} else if (!aLength - detNoLenght <= 0 && detNoLenght > aLength) {
$(".list_u_img_box ").css({
left: 0 + "px"
});
} else {
var nLeft = $(".list_u_img_box a").eq(aLength - detNoLenght).position().left;
$(".list_u_img_box ").css({
left: -nLeft + "px"
});
}
if (detIndex != 0) {
$(".btn_img_prev").removeClass("disab");
}
$(document).on('click', ".btn_img_next", function () {
var viwWidth = $('.view_box').width();
var obj = $(this).siblings(".view_box").find(".list_u_img_box");
var thisIndex = obj.find(".on").index();
var thisLeft = obj.find('.on').position().left;
var nextWidth = obj.find("a").eq(thisIndex).width();
var noLenght = Math.floor(viwWidth / nextWidth);
if (obj.find("a").length - thisIndex <= 2) {
$(this).addClass("disab");
}
if (thisIndex >= 0) {
$(this).siblings(".btn_img_prev").removeClass("disab");
}
obj.find("a").eq(thisIndex + 1).addClass('on').siblings("a").removeClass('on');
if (thisIndex < obj.find("a").length - noLenght) {
obj.css({
left: -(thisLeft + nextWidth) + "px"
});
}
});
$(document).on('click', ".btn_img_prev", function () {
var viwWidth = $('.view_box').width();
var obj = $(this).siblings(".view_box").find(".list_u_img_box");
var thisIndex = obj.find(".on").index();
var thisLeft = obj.find('.on').position().left;
var nextWidth = obj.find("a").eq(thisIndex - 1).width();
var noLenght = Math.floor(viwWidth / nextWidth);
if (obj.find("a").length != thisIndex) {
$(this).siblings(".btn_img_next").removeClass("disab");
}
console.log(thisIndex);
if (thisIndex <= 1) {
$(this).addClass("disab");
}
obj.find("a").eq(thisIndex - 1).addClass('on').siblings("a").removeClass('on');
if (thisIndex < obj.find("a").length - noLenght + 1) {
obj.css({
left: -(thisLeft - nextWidth) + "px"
});
}
});
$('.list_u_img_box> a').on('click.sty', function () {
$(this).addClass('on').siblings("a").removeClass('on');
var thisIndex = $(this).index();
});
}
//鍥炲埌椤堕儴
$(window).scroll(function () {
if ($(window).scrollTop() > 500) {
$(".go_top").fadeIn(500);
} else {
$(".go_top").fadeOut(500);
}
});
//褰撶偣鍑昏烦杞摼鎺ュ悗锛屽洖鍒伴〉闈㈤《閮ㄤ綅缃
$(".go_top").on('click.sty', function () {
$('html,body').animate({
scrollTop: 0
}, 500)
});
//鏃堕棿杞
if ($('body').hasClass('dev_box')) {
if ($(".list_u_img_box a").filter('.on').length == 0) {
$(".list_u_img_box a").first().addClass('on');
}
var detIndex = $(".list_u_img_box a.on").index();
var detLefr = $(".list_u_img_box a.on").position().left;
var detViwWidth = $('.view_box').width();
var aWidth = $(".list_u_img_box a.on").width();
var detNoLenght = Math.floor(detViwWidth / aWidth);
var aLength = $(".list_u_img_box a").length;
var time1 = $(".time_line_case").width();
console.log(detIndex);
console.log(detNoLenght);
if (detIndex <= detNoLenght) {
$(".list_u_img_box ").css({
left: 0 + "px"
});
} else if (detIndex > detNoLenght && detIndex < (aLength - detNoLenght)) {
$(".list_u_img_box ").css({
left: -detLefr + "px"
});
} else if (detIndex >= (aLength - detNoLenght)) {
$(".list_u_img_box ").css({
left: -(detLefr + aWidth - detViwWidth) + "px"
});
}
if (detIndex != 0) {
$(".btn_img_prev").removeClass("disab");
}
if (detIndex == aLength - 1) {
$(".btn_img_next").addClass("disab");
}
//榛樿鏄剧ず鍐呭
$(".dev_tex_box > div").eq(detIndex).show();
//榛樿骞翠唤
var detText = $(".list_u_img_box a.on").text();
$(".at_time > span").text(detText);
$(document).on('click', ".btn_img_next", function () {
var viwWidth = $('.view_box').width();
var obj = $(this).siblings(".view_box").find(".list_u_img_box");
var thisIndex = obj.find(".on").index();
var thisLeft = obj.find('.on').position().left;
var nextWidth = obj.find("a").eq(thisIndex).width();
var noLenght = Math.floor(viwWidth / nextWidth);
if (obj.find("a").length - thisIndex <= 2) {
$(this).addClass("disab");
}
if (thisIndex >= 0) {
$(this).siblings(".btn_img_prev").removeClass("disab");
}
obj.find("a").eq(thisIndex + 1).addClass('on').siblings("a").removeClass('on');
console.log(thisIndex);
console.log(noLenght);
if (thisIndex + 2 <= noLenght) {
$(".list_u_img_box ").css({
left: 0 + "px"
});
} else if (thisIndex + 2 > noLenght && thisIndex + 2 < (obj.find("a").length - noLenght)) {
obj.css({
left: -(thisLeft + nextWidth) + "px"
});
} else if (thisIndex + 2 >= (obj.find("a").length - noLenght)) {
var dLeft = obj.find("a").eq(obj.find("a").length - noLenght).position().left;
obj.css({
left: -(thisLeft + 2 * nextWidth - viwWidth) + "px"
});
}
$(".dev_tex_box > div").eq(thisIndex + 1).show().siblings("div").hide();
$(".time_line_box > div").eq(thisIndex + 3).addClass('on').siblings("div").removeClass("on");
var timeDleft = $(".time_line_box > div").eq(thisIndex + 4).position().left - time1 / 2;
$(".time_line_box").css({
left: -timeDleft + "px"
});
var thisText = obj.find("a").eq(thisIndex + 1).text();
$(".at_time > span").fadeOut(500, function () {
$(this).remove();
$(".at_time").append("" + thisText + "")
})
});
$(document).on('click', ".btn_img_prev", function () {
var viwWidth = $('.view_box').width();
var obj = $(this).siblings(".view_box").find(".list_u_img_box");
var thisIndex = obj.find(".on").index();
var thisLeft = obj.find('.on').position().left;
var nextWidth = obj.find("a").eq(thisIndex - 1).width();
var noLenght = Math.floor(viwWidth / nextWidth);
if (obj.find("a").length != thisIndex) {
$(this).siblings(".btn_img_next").removeClass("disab");
}
if (thisIndex <= 1) {
$(this).addClass("disab");
}
obj.find("a").eq(thisIndex - 1).addClass('on').siblings("a").removeClass('on');
if (thisIndex < obj.find("a").length - noLenght + 1) {
obj.css({
left: -(thisLeft - nextWidth) + "px"
});
}
$(".dev_tex_box > div").eq(thisIndex - 1).show().siblings("div").hide();
$(".time_line_box > div").eq(thisIndex + 1).addClass('on').siblings("div").removeClass("on");
var timeDleft = $(".time_line_box > div").eq(thisIndex + 2).position().left - time1 / 2;
$(".time_line_box").css({
left: -timeDleft + "px"
});
var thisText = obj.find("a").eq(thisIndex - 1).text();
$(".at_time > span").fadeOut(500, function () {
$(this).remove();
$(".at_time").append("" + thisText + "")
})
});
$('.list_u_img_box> a').on('click.sty', function () {
$(this).addClass('on').siblings("a").removeClass('on');
var thisIndex = $(this).index();
$(".dev_tex_box > div").eq(thisIndex).show().siblings("div").hide();
var time2Len = $('.list_u_img_box> a').length;
if (thisIndex == 0) {
$(".btn_img_prev").addClass('disab');
} else {
$(".btn_img_prev").removeClass('disab');
}
if (thisIndex == time2Len - 1) {
$(".btn_img_next").addClass('disab');
} else {
$(".btn_img_next").removeClass('disab');
}
$(".time_line_box > div").eq(thisIndex + 2).addClass('on').siblings("div").removeClass("on");
var timeDleft = $(".time_line_box > div").eq(thisIndex + 3).position().left - time1 / 2;
$(".time_line_box").css({
left: -timeDleft + "px"
});
var thisText = $(this).text();
$(".at_time > span").fadeOut(500, function () {
$(this).remove();
$(".at_time").append("" + thisText + "")
})
});
$(".time_line_box > div").css({
width: (time1 - 20) / 4 + "px"
});
var noPin = $(".time_line_box > div").length;
$(".time_line_box > div").eq(0).addClass("bodes");
$(".time_line_box > div").eq(1).addClass("bodes");
$(".time_line_box > div").eq(noPin - 2).addClass("bodes");
$(".time_line_box > div").eq(noPin - 1).addClass("bodes");
$(".time_line_box > div").eq(detIndex + 2).addClass("on");
var timeDleft = $(".time_line_box > div").eq(detIndex + 3).position().left - time1 / 2;
$(".time_line_box").css({
left: -timeDleft + "px"
});
$(".btn_time").on("click", function () {
$(this).parent("div").addClass('on').siblings("div").removeClass("on");
var thisInde = $(this).parent().index();
var timeDleft = $(this).parent().position().left - time1 / 2 + $(this).parent().width();
$(this).parents(".time_line_box").css({
left: -timeDleft + "px"
});
$(".dev_tex_box > div").eq(thisInde - 2).show().siblings("div").hide();
$('.list_u_img_box> a').eq(thisInde - 2).addClass('on').siblings("a").removeClass('on');
var time2Len = $('.list_u_img_box> a').length;
var viwWidth = $('.view_box').width();
var nextWidth = $('.list_u_img_box> a').eq(0).width();
var noLenght = Math.floor(viwWidth / nextWidth);
var thisLeft = $('.list_u_img_box> a').eq(thisInde - 2).position().left;
if (thisInde - 2 <= noLenght) {
$(".list_u_img_box").css({
left: 0 + "px"
})
} else if (thisInde - 2 > noLenght && thisInde - 2 < (time2Len - noLenght)) {
$(".list_u_img_box ").css({
left: -(thisLeft + nextWidth) + "px"
});
} else if (thisInde - 2 >= (time2Len - noLenght)) {
$(".list_u_img_box").css({
left: -(thisLeft + 2 * nextWidth - viwWidth) + "px"
});
}
if (thisInde == 2) {
$(".btn_img_prev").addClass('disab');
} else {
$(".btn_img_prev").removeClass('disab');
}
if (thisInde == time2Len + 1) {
$(".btn_img_next").addClass('disab');
} else {
$(".btn_img_next").removeClass('disab');
}
var thisText = $(this).children("span").text();
$(".at_time").addClass("ab_on").find("span").text(thisText);
setTimeout(function () {
$(".at_time").removeClass("ab_on")
}, 500);
});
}
if ($("body").hasClass("swip_box")) {
// 鍥㈤槦棰嗚杞挱
var teaSwiper = new Swiper('.swiper-container.tea_mem_case', {
effect: 'fade',
slideActiveClass: 'active',
// 濡傛灉闇€瑕佸墠杩涘悗閫€鎸夐挳
navigation: {
nextEl: '.tea_mem_case .swiper-button-next',
prevEl: '.tea_mem_case .swiper-button-prev',
},
});
// 鍛樺伐椋庨噰杞挱
if ($("body").hasClass("swip_tab1")) {
var sib;
if (wind_w > 780) {
sib = 260;
} else {
sib = 100;
}
var caro1Swiper = new Swiper('.carousel .swiper-container', {
autoplay: {
delay: 3000,
stopOnLastSlide: false,
disableOnInteraction: false,
},
watchSlidesProgress: true,
slidesPerView: 'auto',
centeredSlides: true,
observer: true,
observeParents: true,
on: {
progress: function (progress) {
var i;
var modify;
var translate;
var scale;
var zIndex;
for (i = 0; i < this.slides.length; i++) {
var slide = this.slides.eq(i);
var slideProgress = this.slides[i].progress;
modify = 1;
if (Math.abs(slideProgress) > 1) {
modify = (Math.abs(slideProgress) - 1) * 0.3 + 1;
}
translate = slideProgress * modify * sib + 'px';
scale = 1 - Math.abs(slideProgress) / 5;
zIndex = 999 - Math.abs(Math.round(10 * slideProgress));
slide.transform('translateX(' + translate + ') scale(' + scale + ')');
slide.css('zIndex', zIndex);
slide.css('opacity', 1);
if (Math.abs(slideProgress) > 3) {
slide.css('opacity', 0);
}
}
},
setTransition: function (transition) {
for (var i = 0; i < this.slides.length; i++) {
var slide = this.slides.eq(i);
slide.transition(transition);
}
}
},
slideActiveClass: 'active',
navigation: {
nextEl: '.carousel .swiper-button-next',
prevEl: '.carousel .swiper-button-prev',
},
});
//鍛樺伐椋庨噰tab鍒囨崲
var atLeft = $('.sta_tab_box > span.on').position().left;
var atWidth = $('.sta_tab_box > span.on').outerWidth() / 2;
$('.sta_tab_mark').css({
left: atLeft + atWidth + "px"
});
$('.sta_tab_box > span').on('click', function () {
$(this).addClass('on').siblings("span").removeClass('on');
var atLeft = $(this).position().left;
var atWidth = $(this).outerWidth() / 2;
$('.sta_tab_mark').css({
left: atLeft + atWidth + "px"
});
var thisIndex = $(this).index();
$(".sta_tab_con_box > div").eq(thisIndex).show().siblings("div").hide();
var caro1Swiper = new Swiper('.carousel .swiper-container', {
autoplay: {
delay: 3000,
stopOnLastSlide: false,
disableOnInteraction: false,
},
watchSlidesProgress: true,
slidesPerView: 'auto',
centeredSlides: true,
observer: true,
observeParents: true,
on: {
progress: function (progress) {
var i;
var modify;
var translate;
var scale;
var zIndex;
for (i = 0; i < this.slides.length; i++) {
var slide = this.slides.eq(i);
var slideProgress = this.slides[i].progress;
modify = 1;
if (Math.abs(slideProgress) > 1) {
modify = (Math.abs(slideProgress) - 1) * 0.3 + 1;
}
translate = slideProgress * modify * sib + 'px';
scale = 1 - Math.abs(slideProgress) / 5;
zIndex = 999 - Math.abs(Math.round(10 * slideProgress));
slide.transform('translateX(' + translate + ') scale(' + scale + ')');
slide.css('zIndex', zIndex);
slide.css('opacity', 1);
if (Math.abs(slideProgress) > 3) {
slide.css('opacity', 0);
}
}
},
setTransition: function (transition) {
for (var i = 0; i < this.slides.length; i++) {
var slide = this.slides.eq(i);
slide.transition(transition);
}
}
},
slideActiveClass: 'active',
navigation: {
nextEl: '.carousel .swiper-button-next',
prevEl: '.carousel .swiper-button-prev',
},
});
});
}
//璧勮川鑽h獕
if ($("body").hasClass("swip_tab2")) {
var sib, sib2, sib3;
if (wind_w > 780) {
sib = "vertical";
sib2 = 4;
sib3 = false;
} else {
sib = "horizontal";
sib2 = "auto";
sib3 = true;
}
var serSwiper1 = new Swiper('.hon_con_box1 .swiper-container', {
slideActiveClass: 'active',
effect: 'coverflow',
coverflowEffect: {
rotate: 50,
stretch: 10,
depth: 500,
modifier: 1,
slideShadows: true
},
speed: 1000,
spaceBetween: 10,
autoplayDisableOnInteraction: false,
autoplay: {
delay: 5000,
stopOnLastSlide: false,
disableOnInteraction: false,
},
on: {
slideChangeTransitionStart: function () {
updateNavPosition0();
}
},
navigation: {
nextEl: '.hon_name_box1 .swiper-button-next',
prevEl: '.hon_name_box1 .swiper-button-prev',
},
observer: true,
observeParents: true,
});
var serPageSwiper1 = new Swiper('.hon_name_box1 .swiper-container', {
//visibilityFullFit: true,
direction: sib,
slidesPerView: sib2,
allowTouchMove: false,
observer: true,
observeParents: true,
});
$('.hon_name_box1 .swiper-slide').on('click', function () {
var index = $(this).index();
//鍚屾杩愯鍏跺畠swiper
serSwiper1.slideTo(index);
});
function updateNavPosition0() {
$('.hon_name_box1 .active-nav').removeClass('active-nav');
var activeNav = $('.hon_name_box1 .swiper-slide').eq(serSwiper1.activeIndex).addClass('active-nav');
if (!activeNav.hasClass('swiper-slide-visible')) {
if (activeNav.index() > serPageSwiper1.activeIndex) {
var thumbsPerNav = Math.floor(serPageSwiper1.width / activeNav.width());
serPageSwiper1.slideTo(activeNav.index() - thumbsPerNav);
} else {
serPageSwiper1.slideTo(activeNav.index());
}
}
}
var serSwiper2 = new Swiper('.hon_con_box2 .swiper-container', {
slideActiveClass: 'active',
effect: 'coverflow',
coverflowEffect: {
rotate: 50,
stretch: 10,
depth: 500,
modifier: 1,
slideShadows: true
},
speed: 1000,
spaceBetween: 10,
autoplayDisableOnInteraction: false,
navigation: {
nextEl: '.hon_name_box2 .swiper-button-next',
prevEl: '.hon_name_box2 .swiper-button-prev',
},
observer: true,
observeParents: true,
});
var serPageSwiper2 = new Swiper('.hon_name_box2 .swiper-container', {
//visibilityFullFit: true,
direction: sib,
slidesPerView: sib2,
allowTouchMove: false,
observer: true,
observeParents: true,
preventClicks: false,//榛樿true
});
$('.hon_name_box2 .swiper-slide').on('click', function () {
var index = $(this).index();
//鍚屾杩愯鍏跺畠swiper
serSwiper2.slideTo(index);
});
serSwiper2.on('slideChangeTransitionStart', function () {
updateNavPosition1();
// Do stuff here
});
function updateNavPosition1() {
$('.hon_name_box2 .active-nav').removeClass('active-nav');
var activeNav = $('.hon_name_box2 .swiper-slide').eq(serSwiper2.activeIndex).addClass('active-nav');
if (!activeNav.hasClass('swiper-slide-visible')) {
if (activeNav.index() > serPageSwiper2.activeIndex) {
var thumbsPerNav = Math.floor(serPageSwiper2.width / activeNav.width());
serPageSwiper2.slideTo(activeNav.index() - thumbsPerNav);
} else {
serPageSwiper2.slideTo(activeNav.index());
}
}
}
var serSwiper3 = new Swiper('.hon_con_box3 .swiper-container', {
slideActiveClass: 'active',
effect: 'coverflow',
coverflowEffect: {
rotate: 50,
stretch: 10,
depth: 500,
modifier: 1,
slideShadows: true
},
speed: 1000,
spaceBetween: 10,
autoplayDisableOnInteraction: false,
navigation: {
nextEl: '.hon_name_box3 .swiper-button-next',
prevEl: '.hon_name_box3 .swiper-button-prev',
},
observer: true,
observeParents: true,
});
var serPageSwiper3 = new Swiper('.hon_name_box3 .swiper-container', {
//visibilityFullFit: true,
direction: sib,
slidesPerView: sib2,
allowTouchMove: false,
observer: true,
observeParents: true,
preventClicks: false,//榛樿true
});
$('.hon_name_box3 .swiper-slide').on('click', function () {
var index = $(this).index();
serSwiper3.slideTo(index);
});
serSwiper3.on('slideChangeTransitionStart', function () {
updateNavPosition2();
});
function updateNavPosition2() {
$('.hon_name_box3 .active-nav').removeClass('active-nav');
var activeNav = $('.hon_name_box3 .swiper-slide').eq(serSwiper3.activeIndex).addClass('active-nav');
if (!activeNav.hasClass('swiper-slide-visible')) {
if (activeNav.index() > serPageSwiper3.activeIndex) {
var thumbsPerNav = Math.floor(serPageSwiper3.width / activeNav.width());
serPageSwiper3.slideTo(activeNav.index() - thumbsPerNav);
} else {
serPageSwiper3.slideTo(activeNav.index());
}
}
}
var serSwiper4 = new Swiper('.hon_con_box4 .swiper-container', {
slideActiveClass: 'active',
effect: 'coverflow',
coverflowEffect: {
rotate: 50,
stretch: 10,
depth: 500,
modifier: 1,
slideShadows: true
},
speed: 1000,
spaceBetween: 10,
autoplayDisableOnInteraction: false,
navigation: {
nextEl: '.hon_name_box4 .swiper-button-next',
prevEl: '.hon_name_box4 .swiper-button-prev',
},
observer: true,
observeParents: true,
});
var serPageSwiper4 = new Swiper('.hon_name_box4 .swiper-container', {
//visibilityFullFit: true,
direction: sib,
slidesPerView: sib2,
allowTouchMove: false,
observer: true,
observeParents: true,
preventClicks: false,//榛樿true
});
$('.hon_name_box4 .swiper-slide').on('click', function () {
var index = $(this).index();
//鍚屾杩愯鍏跺畠swiper
serSwiper4.slideTo(index);
});
serSwiper4.on('slideChangeTransitionStart', function () {
updateNavPosition3();
});
function updateNavPosition3() {
$('.hon_name_box4 .active-nav').removeClass('active-nav');
var activeNav = $('.hon_name_box4 .swiper-slide').eq(serSwiper4.activeIndex).addClass('active-nav');
if (!activeNav.hasClass('swiper-slide-visible')) {
if (activeNav.index() > serPageSwiper4.activeIndex) {
var thumbsPerNav = Math.floor(serPageSwiper4.width / activeNav.width());
serPageSwiper4.slideTo(activeNav.index() - thumbsPerNav);
} else {
serPageSwiper4.slideTo(activeNav.index());
}
}
}
// serSwiper2.autoplay.stop();
// serSwiper3.autoplay.stop();
// // serSwiper4.autoplay.stop();
$('.hon_tab_nav_box > div').on('click', function () {
// serSwiper1.autoplay.stop();
// serSwiper2.autoplay.stop();
// serSwiper3.autoplay.stop();
// serSwiper4.autoplay.stop();
if ($('.hon_con_box4').length !=0) {
serSwiper4.autoplay.stop();
}
if ($('.hon_con_box3').length !=0) {
serSwiper3.autoplay.stop();
}
if ($('.hon_con_box2').length !=0) {
serSwiper2.autoplay.stop();
}
if ($('.hon_con_box1').length !=0) {
serSwiper1.autoplay.stop();
}
$(this).addClass('on').siblings("div").removeClass('on');
var thisIndex = $(this).index();
$(".hon_con_case > div").eq(thisIndex).show().siblings("div").hide();
if ($(".hon_con_case > div").eq(thisIndex).find('.hon_con_box4').length !=0) {
serSwiper4.autoplay.start();
}
if ($(".hon_con_case > div").eq(thisIndex).find('.hon_con_box3').length !=0) {
serSwiper3.autoplay.start();
}
if ($(".hon_con_case > div").eq(thisIndex).find('.hon_con_box2').length !=0) {
serSwiper2.autoplay.start();
}
if ($(".hon_con_case > div").eq(thisIndex).find('.hon_con_box1').length !=0) {
serSwiper1.autoplay.start();
}
});
}
// 鍏徃姒傚喌
var comSwiper = new Swiper('.com_img_case .swiper-container', {
slideActiveClass: 'active',
// 濡傛灉闇€瑕佸墠杩涘悗閫€鎸夐挳
navigation: {
nextEl: '.com_img_case .swiper-button-next',
prevEl: '.com_img_case .swiper-button-prev',
},
//鍒嗛〉鍣
// pagination: {
// el: '.com_img_case .swiper-pagination',
// type: 'custom',
// renderCustom: function (swiper, current, total) {
// return '0' + current + ' / ' + '0' + total;
// }
// },
});
}
//
if ($('body').hasClass('publ_body')) {
$('.publ_tab_nav_box > a').on("click.sty", function () {
if (!$(this).hasClass('on')) {
$(this).addClass('on').siblings('a').removeClass('on');
var thisIndex = $(this).index();
$(this).parents('.publ_tab_nav_box').siblings("div").find('> div').eq(thisIndex).show().siblings("div").hide()
}
});
}
if ($('body').hasClass('faq_body')) {
$('.faq_det_show').on('click.sty', function () {
if (!$(this).parent('div').hasClass('on')) {
$(this).parent("div").addClass('on');
} else {
$(this).parent("div").removeClass('on');
}
});
}
if ($('body').hasClass('sel_body')) {
$(".sel_drop_down > .sel_show").on("click", function () {
$(".drop_down_box").hide();
var csBox = $(this).siblings(".drop_down_box");
if (csBox.css("display") == "none") {
$(this).parents(".sel_drop_down").addClass("down_open");
csBox.slideDown(500);
$(this).children("i").addClass("on")
} else {
csBox.css("display", "none");
$(this).parents(".sel_drop_down").removeClass("down_open");
$(this).children("i").removeClass("on")
}
});
$(".drop_down_box li").on("click", function () {
$(this).addClass("on").siblings("li").removeClass("on");
var thisText = $(this).text();
$(this).parents(".sel_drop_down").removeClass(".down_open").find(".sel_show > span").text(thisText);
$(this).parents(".drop_down_box").hide().siblings('input').val(thisText);
$(".sel_show > i").removeClass("on")
});
$(document).on("click", function (event) {
var eve = $(event.target);
if (eve.closest(".down_open").length == 0) {
$(".sel_drop_down").addClass("down_open");
$(".drop_down_box").hide();
$(".sel_show > i").removeClass("on")
} else {
console.log('鐐瑰埌鍏冪礌浜?);
}
});
//鎼滅储妗嗕笅鎷夌粨鏉
}
if ($('body').hasClass('sea_body')) {
var marLeft;
if (wind_w > 640) {
marLeft = 30;
} else {
marLeft = 10;
}
var swWidth = 0;
$(".sea_nav_box a").each(function () {
var thisW = $(this).outerWidth(true) + marLeft;
swWidth += thisW;
return swWidth
});
var faW = $('.sea_res_con_box').outerWidth(true);
if (swWidth > faW) {
var seaSwiper = new Swiper('.sea_nav_box .swiper-container', {
slideActiveClass: 'active',
autoplayDisableOnInteraction: false,
slidesPerView: 'auto',
spaceBetween: marLeft,
navigation: {
nextEl: '.sea_nav_box .swiper-button-next',
prevEl: '.sea_nav_box .swiper-button-prev',
},
observer: true,
observeParents: true,
});
} else {
$('.sea_nav_box').addClass("sea_center");
}
// tab鍒囨崲
$(".sea_nav_box a").on('click.sty', function () {
if (!$(this).hasClass('on')) {
$(".sea_nav_box a").removeClass('on');
$(this).addClass('on');
var thisIndex = $(this).parent(".swiper-slide").index();
console.log(thisIndex);
$(this).parents(".sea_nav_box").siblings('.sea_res_con_box').children('div').eq(thisIndex).show().siblings("div").hide();
}
});
}
$('.sha_btn_close').on('click.sty', function () {
$(this).parent('.sha_con_box').hide();
$('.sha_bg').hide();
});
$('.btn_sha').on('click.sty', function () {
$('.sha_bg').show();
$('.sha_con_box_inquiry').show();
$('html,body').animate({
scrollTop: 0
}, 500)
});
$('.btn_edit').on('click.sty', function () {
if (!$(this).parents('.sha_con_box').hasClass('edit_box')) {
!$(this).parents('.sha_con_box').addClass('edit_box')
}
})
if ($('body').hasClass('pro_det_body')) {
var drawMain = function (drawing_elem, percent, forecolor, bgcolor) {
// @drawing_elem: 缁樺埗瀵硅薄
// @percent锛氱粯鍒跺渾鐜櫨鍒嗘瘮, 鑼冨洿[0, 100]
// @forecolor: 缁樺埗鍦嗙幆鐨勫墠鏅壊锛岄鑹蹭唬鐮
// @bgcolor: 缁樺埗鍦嗙幆鐨勮儗鏅壊锛岄鑹蹭唬鐮
var context = drawing_elem.getContext("2d");
var center_x = drawing_elem.width / 2;
var center_y = drawing_elem.height / 2;
var rad = Math.PI * 2 / 100;
var speed = 0;
var rWidth = 16; //绾跨殑绮楃粏 8
// 缁樺埗鑳屾櫙鍦嗗湀
function backgroundCircle() {
context.save();
context.beginPath();
context.lineWidth = rWidth;
//璁剧疆绾垮
var radius = center_x - context.lineWidth;
context.lineCap = "round";
context.strokeStyle = bgcolor;
context.arc(center_x, center_y, radius, 0, Math.PI * 2, false);
context.stroke();
context.closePath();
context.restore();
}
//缁樺埗杩愬姩鍦嗙幆
function foregroundCircle(n) {
context.save();
context.strokeStyle = forecolor;
context.lineWidth = rWidth;
context.lineCap = "round";
var radius = center_x - context.lineWidth;
context.beginPath();
context.arc(center_x, center_y, radius, -Math.PI / 2, -Math.PI / 2 + n * rad, false);
//鐢ㄤ簬缁樺埗鍦嗗姬context.arc(x鍧愭爣锛寉鍧愭爣锛屽崐寰勶紝璧峰瑙掑害锛岀粓姝㈣搴︼紝椤烘椂閽?閫嗘椂閽?
context.stroke();
context.closePath();
context.restore();
}
//缁樺埗鏂囧瓧
function text(n) {
context.save();
//save鍜宺estore鍙互淇濊瘉鏍峰紡灞炴€у彧杩愮敤浜庤娈礳anvas鍏冪礌
context.fillStyle = forecolor;
var font_size = 40;
context.font = font_size + "px Helvetica";
var text_width = context.measureText(n.toFixed(0) + "%").width;
context.fillText(n.toFixed(0) + "%", center_x - text_width / 2, center_y + font_size / 2);
context.restore();
}
//鎵ц鍔ㄧ敾
(function drawFrame() {
window.requestAnimationFrame(drawFrame);
context.clearRect(0, 0, drawing_elem.width, drawing_elem.height);
backgroundCircle();
// text(speed);
foregroundCircle(speed);
if (speed >= percent) return;
speed += 1;
}());
};
var topp = $(document).scrollTop();
var thisT = $('.det_proportion_box').offset().top - $(window).height();
if (topp > thisT) {
if (!$('.det_proportion_box').hasClass('on')) {
$('.det_proportion_box').addClass('on');
var vNum, time_canvas, nNum;
$('.time-graph-canvas').each(function () {
vNum = $(this).data('value');
nNum = $(this).data('nnum');
time_canvas = document.getElementById('time-graph-canvas' + nNum + '');
// return vNum,time_canvas;
drawMain(time_canvas, vNum, "#07933d", "#d5dbe0");
});
}
} else if (topp < thisT) {
$('.det_proportion_box').removeClass('on');
}
$(window).on('scroll touchmove', function () {
var topp = $(document).scrollTop();
var thisT = $('.det_proportion_box').offset().top - $(window).height();
if (topp > thisT) {
if (!$('.det_proportion_box').hasClass('on')) {
$('.det_proportion_box').addClass('on');
var vNum, time_canvas, nNum;
$('.time-graph-canvas').each(function () {
vNum = $(this).data('value');
nNum = $(this).data('nnum');
time_canvas = document.getElementById('time-graph-canvas' + nNum + '');
// return vNum,time_canvas;
drawMain(time_canvas, vNum, "#07933d", "#d5dbe0");
});
}
} else if (topp < thisT) {
$('.det_proportion_box').removeClass('on');
}
})
}
})(jQuery, window, document);