var istouch = modernizr.touch, ismobile = false,//区分移动端与pc端 mobile = false,//区分手机端与平板 w_width = 0, w_height = 0, $mtoph = 0, st = 0, navitem = 0, $menubtn=$('.menubtn'), $menubox=$(".menubox"); //移动端事件和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(); $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; }; changepnav(); }; pagebox(); $(window).resize(function () { pagebox(); }); $(function () { $('.hdbtn').mouseenter(function(){ $(this).addclass('act'); $(this).parent().find('.c-hide-box').addclass('show'); }); $('.myhidelayer').mouseleave(function(){ $(this).find('.hdbtn').removeclass('act'); $(this).find('.c-hide-box').removeclass('show'); }); $('.navmobile dd p a').click(function(e){ if($(this).parent().next('.mtnav').size() >= 1){ if(!$(this).hasclass('act')){ e.preventdefault(); $('.navmobile dd p a').removeclass('act'); $('.mtnav').stop().slideup(300); $(this).addclass('act'); $(this).parent().next('.mtnav').stop().slidedown(300); }else{ $(this).removeclass('act'); $(this).parent().next('.mtnav').stop().slideup(300); } } }); $menubtn.bind(_click, function () { if (navitem == 0) { $('.menublack').stop().fadein(); jquery(this).addclass("open"); $menubox.show().stop(false,false).animate({right:0}); navitem = 1; } else { $('.menublack').stop().fadeout(); $(this).removeclass("open"); $menubox.stop(false,false).animate({right:-320+"px"},function(){ $(this).hide(); }); navitem = 0; }; }); $('.menublack').bind(_click, function () { $(this).stop().fadeout(); $menubtn.removeclass("open"); $menubox.stop(false,false).animate({right:-320+"px"},function(){ $(this).hide(); }); navitem = 0; }); $(window).scroll(function () { var windowtop = $(window).scrolltop(); if (windowtop < w_height && !ismobile) { $('.pbanner .pic2 img').css('transform', "translate(0px," + (windowtop) / 1.5 + "px)"); }; changepnav(); }); changepnav(); function setscroll(anchorcur){ if(jquery(anchorcur).length>=1){ jquery("html,body").animate({ scrolltop: jquery(anchorcur).offset().top-$mtoph}, 0); } }; window.onload = function () { var hash = location.href.split("#")[1]; if (hash) { setscroll("#" + hash); } } settimeout(function(){ $('.pbtxts').addclass('animation'); },100); //weixin setpopup($('.weixin'), "官方微信"); function setpopup(obj, title) { obj.click(function () { var str = '
'; $("body").append(str); jquery(".popupblack").fadein(); jquery(".popup").animate({margintop:"-127"},400); $(".popup .close").click(function () { $(".popupblack").remove(); }); jquery(".popupblack").click(function(){$(".popupblack").remove();}); return false; }); }; }); function fixmove(o1,o2,h){ var st = $(window).scrolltop(); if(st>o1.offset().top-h){ o2.css({top:st-o1.offset().top+h}); }else{ o2.css({top:0}); } }; function changepnav(){ if($('.pnav').size()!=0&&!ismobile){ fixmove($('.page-ctt'),$('.pager'),$mtoph); } }; var isnum = 1, count_num1,count_num2,count_num3,count_num4,a,b,c,d; function changenum(){ isnum = 0; var options = { useeasing : true, usegrouping : true, separator : '', decimal : '.', prefix : '', suffix : '' }; count_num1=$("#count_1").attr("data-num"); count_num2=$("#count_2").attr("data-num"); count_num3=$("#count_3").attr("data-num"); count_num4=$("#count_4").attr("data-num"); if(count_num1){a=new countup("count_1",0,count_num1,0,2.5,options);} if(count_num2){b=new countup("count_2",0,count_num2,0,2.5,options);} if(count_num3){c=new countup("count_3",0,count_num3,0,2.5,options);} if(count_num4){d=new countup("count_4",0,count_num4,0,2.5,options);} }; function numstart(){ st = $(window).scrolltop(); if(isnum==0) { if(count_num1){a.start();} if(count_num2){b.start();} if(count_num3){c.start();} if(count_num4){d.start();} isnum = 1; }else{ return true; } };