(function() {
var popie = function(){
if(window.innerwidth>=680){
function ietester(useragent) {
var ua = useragent || navigator.useragent;
if (/msie/i.test(ua)) {return ua.match(/msie (\d+\.\d+)/i)[1];} else if (~ua.tolowercase().indexof('trident') && ~ua.indexof('rv')) {return ua.match(/rv:(\d+\.\d+)/)[1];}
return false;
}
if (ietester() == 9.0 || ietester() == 8.0 || ietester() == 7.0 || ietester() == 6.0 || ietester() == 5.0) {
var hintie = '
';
$("body").prepend(hintie);$(".popie").show();
$(".popie-close").click(function(){$(".popie").hide();});
}
ietester('mozilla/5.0 (windows nt 6.3; wow64; trident/7.0; rv:11.0) like gecko');
}
}
var equipmentfn = function(){
if (window.innerwidth >= 1000) {$("body").addclass("pc");}else{$("body").removeclass("pc");}
if (window.innerwidth < 1000 && window.innerwidth >= 640) {$("body").addclass("pad");}else{$("body").removeclass("pad");}
if (window.innerwidth < 640) {$("body").addclass("mb");}else{$("body").removeclass("mb");}
}
var mbpenetrate = function(el){
var elnum = document.getelementsbyclassname(el).length;
if(window.innerwidth >= 1000 || elnum == 0){return false;}
for(var i = 0; i
0 && e.cancelable){e.preventdefault();}else if(scrolltop >= realheight - viewheight && newtargety - targety <0 && e.cancelable){e.preventdefault();}
},false);
}
}
var bandrag = function(){$("body").find("img,a").attr("ondragstart","return false");}
var navbarfn = function(){
$('.header-navclick').click(function () {
if(window.innerwidth < 1000 && $(".header-search-click").length > 0){$(".header-search-click").removeclass("active");$(".header-search-item").removeclass("active");$("body").removeclass("onsearch");}
if($('.header-navbar').is(':hidden')){
$(this).addclass('active');$('.header-navbar').fadein(360).addclass("active");
$("body,html").css({"overflow":"hidden"});
}
else{
$(this).removeclass('active');$('.header-navbar').fadeout(300).removeclass("active");
$("body,html").css({"overflow":""});
}
});
}
var headerli = function(){
if(window.innerwidth >= 1000){return false;}
var litime = 0.12;
$(".header-navbar ul li").each(function(){$(this).css('transition-delay', litime +'s');litime += 0.12;});
}
var searchfn = function(){
$(".header-search-click").click(function(){
if(window.innerwidth < 1000 && $(".header-navclick").length > 0){$('.header-navclick').removeclass('active');$('.header-navbar').hide().removeclass("active");$("body,html").css({"overflow":""});}
if(!$(this).hasclass("active")){$(this).addclass("active");$(".header-search-item").addclass("active");$("body").addclass("onsearch");}
else{$(this).removeclass("active");$(".header-search-item").removeclass("active");$("body").removeclass("onsearch");}
});
}
var headerdrop = function(){
if(window.innerwidth < 1000){return false;}
$(".header-navbar li").hover(function () {$(this).find(".header-drop").stop().slidedown(360);}, function () {$(this).find(".header-drop").stop().slideup(300);});
}
var headerdropmb = function(){
$(".header-arrow").click(function(){
if($(this).next(".header-drop").is(':hidden')) {
$(".header-arrow").removeclass('active');$(".header-drop").slideup(240);
$(this).addclass('active');$(this).next(".header-drop").slidedown(280);
}
else{$(this).removeclass('active');$(this).next(".header-drop").slideup(240);}
});
}
var footerdropmb = function(){
if(window.innerwidth >= 1000){return false;}
$(".footer-menu").click(function(){
if($(this).next(".footer-drop").is(':hidden')) {
$(".footer-menu").removeclass('active');$(".footer-drop").slideup(240);
$(this).addclass('active');$(this).next(".footer-drop").slidedown(280);
}
else{$(this).removeclass('active');$(this).next(".footer-drop").slideup(240);}
});
}
var sonmenu = function(f,s){
if($(s).length <= 0 || window.innerwidth>=680){return false;}
var menuwidth = 0;
var menumargin = parseint($(s).find("a").css('marginleft'));
$(s).find("a").each(function(){menuwidth += $(this)[0].getboundingclientrect().width + menumargin*2;});
$(s).width(menuwidth);
var ontrueleft;
if($(s).find("a").hasclass("active")){ontrueleft = $(s).find("a.active").offset().left - menumargin}else{ontrueleft = 0}
settimeout(function(){$(f).animate({'scrollleft': menuwidth-$(window).width()}, 800).after().animate({'scrollleft': ontrueleft}, 800)},800);
}
var langfn = function(){
if(window.innerwidth >= 1000){
$(".header-lang").hover(function () {$(this).addclass("active");}, function () {$(this).removeclass("active");});
}else{
$(".header-lang").click(function(e){
if($(".header-navclick").length > 0){$('.header-navclick').removeclass('active');$('.header-navbar').hide().removeclass("active");$("body,html").css({"overflow":""});}
if($(".header-search-click").length > 0){$(".header-search-click").removeclass("active");$(".header-search-item").removeclass("active");$("body").removeclass("onsearch");}
if(!$(this).hasclass("active")){$(this).addclass("active");$(".header-lang-more").show();}else{$(this).removeclass("active");$(".header-lang-more").hide();}
e.stoppropagation();
});
$(window).click(function(){$(".header-lang-more").hide();$(".header-lang").removeclass("active");});
}
}
var backtop = function(){
$(window).scroll(function () {if ($(window).scrolltop() > 200) {$('.backtop').fadein(300);} else {$('.backtop').fadeout(200);}});
var isclick = true;
$(".scrolltop").click(function (){
if (isclick && $(window).scrolltop() > 0) {isclick = false;$("html,body").animate({scrolltop: "0px"}, 800);}
settimeout(function () {isclick = true;}, 800);
});
}
// 执行函数 ******************************************************************************************************************************
$(function() {
popie(); // 判断ie版本提示
equipmentfn(); // body-class设备信息
mbpenetrate("navbarscroll"); //移动端禁止穿透 传入class
headerli(); //移动端导航出场动画
bandrag(); //禁止图片、a标签拖动
navbarfn(); //移动端汉堡键
searchfn(); //搜索
headerdrop(); //导航下拉
headerdropmb(); //移动端-导航下拉
footerdropmb(); //移动端-底部导航下拉
langfn(); //语言
backtop(); //置顶
$(".customerservice-btn").click(function(){
$(this).siblings(".li-box1").show()
})
$(".fixed-right ul li .li-box1 .box-t .icon-guanbi1").click(function(){
$(".fixed-right ul li .li-box1").hide()
})
// sonmenu(".sonbar-menu",".sonbar-menu-scroll"); //移动端-内页菜单("定义overflow-x: auto的父元素","设置宽度的子元素")
});
// 全局函数 ******************************************************************************************************************************
// 数字前面补0,使用 $.prefixinteger(num,length)
jquery.prefixinteger = function(num, length) {return (array(length).join('0') + num).slice(-length);}
// 窗口事件 ******************************************************************************************************************************
$(window).resize(function () {
equipmentfn();// body-class设备信息
});
// 滚动事件 ******************************************************************************************************************************
$(window).scroll(function () {});
}());