var istouch = modernizr.touch, ismobile = false,//区分移动端与pc端 mobile = false,//区分手机端与平板 w_width = 0, w_height = 0, bannerimgh=638, navitem = 0, h_height=0, roll=0, stop=150, produs=0, st = 0; var _mousemove; var _click; var _mousedown; var _mouseup; //移动端事件和pc事件的切换 if (modernizr.touch) { _mousemove = "touchmove"; _click = "touchend"; _mousedown = "touchstart"; _mouseup = "touchend"; } else { _mousemove = "mousemove"; _click = "click"; _mousedown = "mousedown"; _mouseup = "mouseup"; }; function pagebox() { w_width = jquery(window).width(); w_height = jquery(window).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(!ismobile){ }else{ $(".pbanner,.introductt,.introductfix,.culturein,.speechle,.speechd,.framework,.construst,.construstfix,.tender-list,.tendeon,.announce li,.winning li,.people,.resoucetop,.resoucein").removeclass('article-block'); } } pagebox(); jquery(window).resize(function () { pagebox(); }); $(".link span").mouseenter(function(){ $(this).addclass('on'); $(this).next('.linkdown').stop().slidedown(); }); $(".link").mouseleave(function(){ $(this).find('span').removeclass('on'); $('.linkdown').stop().slideup(); }); $( '.menubtn' ).on('click', function(e) { e.stoppropagation(); $(this).toggleclass('active'); $(".navigate").toggleclass('on'); $(".navigateli >li").removeclass('on'); $(".meundonw").hide(); }); $(".navigatebg").click(function(){ $('.menubtn').removeclass('active'); $(".navigate").removeclass('on'); }); $('.iphone-fix span').click(function(){ $('.iphone-down').slidetoggle(); }); gethash(); jquery(".menufix li a,.iphone-down a,.meundonw li a").click(function(e){ var hash=jquery(this).attr("href").split("#")[1]; if(hash && jquery("#"+hash).length==1){ setscroll("#"+hash); } $(".navigate").removeclass('on'); $(".navigateli >li").removeclass('on'); $(".meundonw").hide(); $(".menubtn").removeclass('active'); }); function gethash(){ var hash = location.href.split("#")[1]; if(hash){ setscroll("#"+hash); } }; var scnum=0; function setscroll(anchorcur){ scnum=$(".header-box").outerheight(); jquery("html,body").animate({ scrolltop: jquery(anchorcur).offset().top-scnum},20); }; jquery(".navigateli >li >a").bind("click", function (e) { var $navmobile=jquery(".navigate"), $nava=$navmobile.find(".navigateli >li >a"), $msubnav=$navmobile.find(".meundonw"); var hjcur = $(this); var hjdd = $(this).parents("li"); if (hjdd.find(".meundonw").size() > 0) { if (hjdd.hasclass("on")) { $navmobile.slideup(); hjdd.find(".meundonw").stop(false, false).slideup(); hjdd.removeclass("on"); $navmobile.slideup(); } else { $nava.parents('li').removeclass("on"); $msubnav.stop(false, false).slideup(); hjdd.find(".meundonw").stop(false, false).slidedown(); hjdd.addclass("on"); e.preventdefault(); } } }); function c() { var s = $(window).scrolltop(); s >= 1 ? $(".header-box").addclass("scoll") : $(".header-box").removeclass("scoll"); } $(window).scroll(c), c() var index=$(".menufix li.current").index(); jquery(".menufix li").hover(function(){ $(this).addclass('current').siblings().removeclass('current'); },function(){ jquery(".menufix li").removeclass('current').eq(index).addclass('current'); }); $('.backtop').click(function(e){ e.preventdefault(); jquery("html,body").animate({ scrolltop: 0}, 600, 'easeinoutexpo'); }); jquery(window).scroll(function () { var windowtop = jquery(window).scrolltop(); if (windowtop < w_height && !ismobile) { jquery('.pbanner figure img').css('transform', "translate(0px," + (windowtop) / 1.5 + "px)"); }; }); 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 setimgmax(img, imgw, imgh, tw, th) { var twidth = tw || w_width; var theight = th || w_height; var coe = imgh / imgw; var coe2 = theight / twidth; if (coe < coe2) { var imgwidth = theight / coe; img.css({ height: theight, width: imgwidth, left: -(imgwidth - twidth) / 2, top: 0 }); } else { var imgheight = twidth * coe; img.css({ height: imgheight, width: twidth, left: 0, top: -(imgheight - theight) / 2 }); }; };