$(function () {
var en = window.location.pathname;
en = en.substring(1, en.length);
//绠€浣撲腑鏂
$(".traditional").click(function () {
zh_tran('s')
setCookie("typeface", "s")
setCookie('think_var', 'zh-cn');
$(".en_btn").html("绠€")
window.location.href = "/";
$(this).addClass("on").siblings().removeClass("on");
$(".banner_box .swiper-slide .jianti").show();
$(".banner_box .swiper-slide .fanti").hide();
/*
$(".gongsirongyu .top_img ").attr("src","/template/1/default/_files/images/guanyuwomen/songsirongyao.jpg")
$(".dashiji .top_img ").attr("src","/template/1/default/_files/images/guanyuwomen/dshiji.jpg");
$(".vip_dengji.p ").attr("src","/template/1/default/_files/images/vip_jihua/vip_dengji.jpg");
$(".vip_dengji1 ").attr("src","/template/1/default/_files/images/vip_jihua/vip_dengji1.jpg");
$(".rencaizhanlue ").attr("src","/template/1/default/_files/images/join/rencaizhanlue.jpg");
$(".zuzhijiagou_img ").attr("src","/template/1/default/_files/images/guanyuwomen/zuzhijiagou.jpg");
$(".zuzhijiagou_img_m ").attr("src","images/guanyuwomen/m_zuzhijiagou.jpg");
*/
})
//绻佷綋涓枃
$(".simplified").click(function () {
zh_tran('t')
setCookie("typeface", "t")
setCookie('think_var', 'zh-cn');
$(".en_btn").html("绻?/span>")
window.location.href = "/";
$(this).addClass("on").siblings().removeClass("on");
$(".banner_box .swiper-slide .fanti").show();
$(".banner_box .swiper-slide .jianti").hide();
/*
$(".gongsirongyu .top_img ").attr("src","/template/1/default/_files/images/guanyuwomen/songsirongyao_t.jpg")
$(".dashiji .top_img ").attr("src","/template/1/default/_files/images/guanyuwomen/dshiji_t.jpg");
$(".vip_dengji.p ").attr("src","/template/1/default/_files/images/vip_jihua/vip_dengji_t.jpg");
$(".vip_dengji1 ").attr("src","/template/1/default/_files/images/vip_jihua/vip_dengji1_t.jpg");
$(".rencaizhanlue ").attr("src","/template/1/default/_files/images/join/rencaizhanlue_t.jpg");
$(".zuzhijiagou_img ").attr("src","/template/1/default/_files/images/guanyuwomen/zuzhijiagou_t.jpg");
$(".zuzhijiagou_img_m ").attr("src","images/guanyuwomen/m_zuzhijiagou_t.jpg");
*/
})
//鑻辨枃
$(".english").click(function () {
zh_tran('e')
setCookie("typeface", "e")
setCookie('think_var', 'en');
//window.location.href = "/en/";
/*var url = window.location.href;
if(url.indexOf('?') != -1){
url = url + '&lang=en';
}else{
url = url + '?lang=en';
}
window.location.href = url;*/
$(".en_btn").html("EN")
$(this).addClass("on").siblings().removeClass("on");
//window.location.href = "/?lang=en";
window.location.href = "/";
})
var typeface = getCookie("typeface")
var think_var = getCookie("think_var");//zh-cn
if (typeface == "s") {
zh_tran('s')
$(".en_btn").html("绠€")
$(".traditional").addClass("on").siblings().removeClass("on");
$(".banner_box .swiper-slide .jianti").show();
$(".banner_box .swiper-slide .fanti").hide();
$(".banner_box .swiper-slide .jianti").show();
$(".ft").hide();
$(".jt").show();
} else if (typeface == "e") {
zh_tran('e')
$(".en_btn").html("EN")
$(".english").addClass("on").siblings().removeClass("on");
} else if (typeface == "t") {
$(".en_btn").html("绻?/span>")
zh_tran('t')
$(".simplified").addClass("on").siblings().removeClass("on");
$(".banner_box .swiper-slide .fanti").show();
$(".banner_box .swiper-slide .jianti").hide();
$(".ft").show();
$(".jt").hide();
/*$(".gongsirongyu .top_img ").attr("src","/template/1/default/_files/images/guanyuwomen/songsirongyao_t.jpg")
$(".dashiji .top_img ").attr("src","/template/1/default/_files/images/guanyuwomen/dshiji_t.jpg")
$(".vip_dengji.p ").attr("src","/template/1/default/_files/images/vip_jihua/vip_dengji_t.jpg");
$(".vip_dengji1 ").attr("src","/template/1/default/_files/images/vip_jihua/vip_dengji1_t.jpg");
$(".rencaizhanlue ").attr("src","/template/1/default/_files/images/join/rencaizhanlue_t.jpg");
$(".zuzhijiagou_img ").attr("src","/template/1/default/_files/images/guanyuwomen/zuzhijiagou_t.jpg");*/
}else {
zh_tran('s')
setCookie("typeface", "s")
$(".en_btn").html("绠€")
$(".banner_box .swiper-slide .jianti").show();
$(".traditional").addClass("on").siblings().removeClass("on");
$(".banner_box .swiper-slide .fanti").hide();
$(".banner_box .swiper-slide .jianti").show();
}
// 鎵嬫満瀵艰埅
$('.menuBtn').click(function (event) {
$('.nav').stop().slideToggle();
$(this).stop().toggleClass('open');
event.stopPropagation();
});
// $(".nav_bg").height($(window).height() - 250)
// $(".ov_nav").css("top", $(window).height() - 210)
$(document).click(function (e) {
if (e.target.tagName == "DIV") {
$('.nav').stop().slideUp();
$(".menuBtn").stop().removeClass('open');
}
});
$(".nav .fast").click(function (e) {
$('.nav').stop().slideUp();
$(".menuBtn").stop().removeClass('open');
});
if ($(window).width() < 1200) {
$(".foot_box .list").click(function () {
if ($(this).find("ul").is(':hidden')) {
$(this).find("ul").show(600);
$(this).find("h4").css("background", "url(\"/template/1/default/_files/images/index/foot_up.png\") no-repeat right")
} else {
$(this).find("ul").hide(600);
$(this).find("h4").css("background", "url(\"/template/1/default/_files/images/index/foot_xiala.png\") no-repeat right")
}
})
}
$(".swiper-container").height($(window).height() - 60);
// 鍥炲埌椤堕儴js
$(window).scroll(function () {
if ($(window).scrollTop() > 100) {
$("#back-to-top").css("visibility", "visible");
}
else {
$("#back-to-top").css("visibility", "hidden");
}
});
$("#back-to-top").click(function () {
//$('body,html').animate({scrollTop:0},1000);
if ($('html').scrollTop()) {
$('html').animate({scrollTop: 0}, 600);
return false;
}
$('body').animate({scrollTop: 0}, 600);
return false;
});
if ($(window).width() <= 767) {
$(".nav_bg li>a").addClass("on")
$(".nav_bg li").click(function () {
$('.nav_bg li dl').slideUp();
if ($(this).find("dl").is(':hidden')) {
$(this).find("dl").slideDown();
$(this).find("i").css("background", "url(/template/1/default/_files/images/index/m_nav_shangla.png) no-repeat right")
} else {
$(this).find("dl").slideUp();
$(this).find("i").css("background", "url(/template/1/default/_files/images/index/m_nav_xiala.png) no-repeat right")
}
})
} else {
$(".nav_bg li>a").removeClass("on")
}
$(".so").click(function () {
window.location.href = "/search/";
})
// 椤甸潰tab瀵艰埅
$(".m_btn h5").click(function () {
var that = $(this);
if ($(this).next().is(':hidden')) {
that.addClass("on");
$(".m_btn #tab").slideDown();
} else {
$(".m_btn #tab").slideUp();
that.removeClass("on");
}
$(document).click(function (event) {
if (event.target.tagName != 'H5') {
$(".m_btn #tab").slideUp();
that.removeClass("on");
}
})
});
//nav鍏抽棴鎸夐挳鏄剧ず闅愯棌
$(".nav_bg li").hover(function () {
if ($(this).find("dl").length == 0) {
console.log(1)
$(".nav_box>.fast").css("opacity", 1);
} else {
$(".nav_box>.fast").css("opacity", 0);
}
},function () {
$(".nav_box>.fast").css("opacity", 1);
})
$(".foot_box .weixin").hover(function () {
$(this).attr("src", "/template/1/default/_files/images/index/weixin_icon_on.png")
}, function () {
$(this).attr("src", "/template/1/default/_files/images/index/weixin_icon.png")
});
$(".foot_box .weibo").hover(function () {
$(this).attr("src", "/template/1/default/_files/images/index/weibo_icon_on.png")
}, function () {
$(this).attr("src", "/template/1/default/_files/images/index/weibo_icon.png")
});
if($(window).width()<920){
$(".x").click(function () {
window.location.reload()
})
}
//鏂伴椈婧㈠嚭闅愯棌
overFn('.remen h4', 10);
overFn('.women h3', 8);
overFn('.right a>p', 100);
function overFn(ele, len) {
var content_arr = [];//瀹氫箟涓€涓┖鏁扮粍
$(ele).each(function () {//閬嶅巻box鍐呭
var content = $.trim($(this).text());//鍘绘帀鍓嶅悗鏂囩┖鏍
content_arr.push(content);//鍐呭鏀捐繘鏁扮粍
for (var i = 0; i < content_arr.length; i++) {//閬嶅巻寰幆鏁扮粍
if (content_arr[i].length >= len) {//濡傛灉鏁扮粍闀垮害锛堜篃灏辨槸鏂囨湰闀垮害锛夊ぇ浜庣瓑浜?0锛堟暟瀛楀彲鑷繁瀹氫箟锛
content = content_arr[i].substr(0, len) + '...';//娣诲姞鐪佺暐鍙峰苟鏀捐繘box鏂囧瓧鍐呭鍚庨潰
$(ele).eq(i).text(content);
} else {
content = content_arr[i];
$(ele).eq(i).text(content);
}
}
})
}
});
//鍐檆ookies
function setCookie(name, value, expiredSeconds) {
var Days = 360 * 24 * 60 * 60 * 1000;
if (expiredSeconds != undefined) {
Days = expiredSeconds * 1000;
}
var exp = new Date();
exp.setTime(exp.getTime() + Days);
//document.cookie = name + "="+ encodeURIComponent (value) + ";domain="+domain+";path=/;expires=" + exp.toGMTString();
document.cookie = name + "=" + encodeURIComponent(value) + ";path=/;expires=" + exp.toGMTString();
}
//js
function setCookieAdmin(name,value,seconds) {
var expires = "";
if (seconds) {
var date = new Date();
date.setTime(date.getTime() + (seconds*1000));
expires = "; expires=" + date.toUTCString();
}
document.cookie = name + "=" + (value || "") + expires + "; path=/";
}
function getCookie(name) {
var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
if (arr = document.cookie.match(reg))
return decodeURIComponent(arr[2]);
else
return null;
}