var istouch = modernizr.touch, ismobile = false,//区分移动端与pc端 mobile = false,//区分手机端与平板 w_width = 0, w_height = 0, $mtoph = 0, st = 0, navitem = 0, $menubtn=$('.menu-handler'), $menubox=$(".menubox"), pbah = 0; //移动端事件和pc事件的切换 var _mousemove; var _click; var _mousedown; var _mouseup; if (modernizr.touch) { _mousemove = "touchmove"; _click = "touchend"; _mousedown = "touchstart"; _mouseup = "touchend"; } else { _mousemove = "mousemove"; _click = "click"; _mousedown = "mousedown"; _mouseup = "mouseup"; }; function pagebox() { w_width = $(window).width(); w_height = $(window).height(); $hdh = $('.header').innerheight(); $mtoph = $('.mtop').height(); if (w_width <= 1024) { ismobile = true; } else if (w_width > 1024) { ismobile = false; }; if (w_width <= 640) { mobile = true; } else if (w_width > 640) { mobile = false; }; if( w_width > 1152 ){ pbah = $hdh; }else{ pbah = $mtoph; } if( w_width > 861 ){ $('.pbanner').css({height:w_height - pbah}); setimgmax($('.pbanner .pic'), 1880, 834, w_width, w_height - pbah); }else{ $('.pbanner').css({height:"auto"}); $('.pbanner .pic').attr("style",""); } }; pagebox(); $(window).resize(function () { pagebox(); }); var menu = { trigger: ".menu-handler", init: function () { menu.bind(); }, bind: function () { $(document).on("click", menu.trigger, menu.open); $(document).on("click", ".navmobile dd p a", function (e) { var stcur = $(this); var stdd = $(this).parents("p").parents("dd"); if (stdd.find(".msubnav").size() > 0) { if (stcur.hasclass("cur")) { stdd.find(".msubnav").stop(false, false).slideup(); stcur.removeclass("cur"); } else { jquery(".navmobile dd p a").removeclass("cur"); jquery(".msubnav").stop(false, false).slideup(); stdd.find(".msubnav").stop(false, false).slidedown(); stcur.addclass("cur"); e.preventdefault(); } } }); $(document).on("click", "#bg-santai", menu.open) }, open: function () { if ($("body").is(".open")) { $("body").removeclass("open"); $(".menu-handler").removeclass("active"); $("#bg-santai").fadeto("fast", 0, function () { $("#bg-santai").hide(); }); } else { $("#bg-santai").fadeto("fast", 0.4); $("body").addclass("open"); $(".menu-handler").addclass("active"); } } }; $(function () { $(window).scroll(function () { st = $(window).scrolltop(); if (st < w_height&&$('.pbanner').size()!=0&&!ismobile) { $('.pbanner .pic').css('transform',"translate(0px,"+(st) / 1.5+"px)"); } changeheader(); }); //pc nav $('.nav li').mouseenter(function(){ if($(this).find('.tnavbox').size()!=0){ $(this).find('.tnavbox').addclass('show'); } }).mouseleave(function(){ if($(this).find('.tnavbox').size()!=0){ $(this).find('.tnavbox').removeclass('show'); } }); if($('.pbanner').length>=1){ settimeout(function() { $('.pbanner').addclass('trans-1'); $('.pbanner').removeclass('picw'); //$('.pbtxts .transx').addclass('transshow'); //$('.pbtxts .transx2').addclass('transshow'); }, 100); settimeout(function() { $('.pbanner').removeclass('trans-1'); }, 600); }; if(w_width>1153){ $('.menu-handler').bind(_click, function(){ if (navitem == 0) { $(this).addclass('active'); $('.htnavbox').addclass('shownav'); navitem = 1; }else{ $(this).removeclass('active'); $('.htnavbox').removeclass('shownav'); navitem = 0; }; }); }else{ menu.init(); } function changeheader(){ if($('.header2').size()!=0&&!ismobile){ st = $(window).scrolltop(); if(st > $hdh){ $('.header2').addclass('show'); }else{ $('.header2').removeclass('show'); } } }; changeheader(); $('.bamouse').click(function(){ $("html,body").animate({scrolltop:w_height},800,"easeinoutexpo"); }); //pc nav end //手机nav /* function gethash() { var hash = location.href.split("#")[1]; if (hash) { settimeout(function () { $("html,body").animate({ scrolltop: $("#" + hash).offset().top - $mtoph }, 800); }, 250); } }; gethash(); $('.abnav li').click(function(){ var phash = $(this).find('a').attr('href').split("#")[1]; if (phash) { settimeout(function () { $("html,body").animate({ scrolltop: $("#" + phash).offset().top - $mtoph - 36 }, 800,'easeinoutexpo'); }, 250); $(this).find('a').addclass('act').end().siblings().find('a').removeclass('act'); } }); */ //back top -- 回到顶部 /* $('#top').click(function(){ $('html,body').stop().animate({scrolltop:0},500,"easeinoutexpo"); }); */ //weixin setpopup($('.weixin'), "官方微信"); function setpopup(obj, title) { obj.click(function () { var str = '