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){ ST = $(window).scrollTop(); if (ST < 1) { $('.headers').removeClass('scollfox'); } else { $('.headers').addClass('scollfox'); } $(window).scroll(function () { ST = $(window).scrollTop(); if (ST < 1) { $('.headers').removeClass('scollfox'); } else { $('.headers').addClass('scollfox'); } }); }else{ $(".micro-info,.microtext,.lovelife,.creatimg,.cdynamic,.personnel,.aboubox,.culture-info,.commonwealtop,.phostop,.commonwealist li,.finace,.personner-info,.need,.position,.need-info").removeClass('article-block'); } } pageBox(); jQuery(window).resize(function () { pageBox(); }); $( '#menu_toggle' ).on('click', function(e) { e.stopPropagation(); $('.menus > li').removeClass('on'); $('.menufix').slideUp(); $(this).toggleClass('active'); $('.menu-list').toggleClass('on'); }); $(".isearch span").click(function(e){ e.stopPropagation(); $(".searchBox").slideToggle(); }); $(document).on('click',function(e){ e.stopPropagation(); $(".searchBox,.iphone-down").slideUp(); }); $('.iphone-fix span').click(function(e){ e.stopPropagation(); $('.iphone-down').slideToggle(); }); var index_ = $(".navs-li >li.active").index(); $(".navs-li >li").hover(function(){ $(this).addClass("active").siblings().removeClass("active"); },function(){ $(".navs-li >li").removeClass("active").eq(index_).addClass("active"); }); jQuery(".menus > li > a").bind("click", function (e) { var $navMobile=jQuery(".menu-list"), $navA=$navMobile.find(".menus > li > a"), $mSubnav=$navMobile.find(".menufix"); var hjcur = $(this); var hjDD = $(this).parents("li"); if (hjDD.find(".menufix").size() > 0) { if (hjDD.hasClass("on")) { $navMobile.slideUp(); hjDD.find(".menufix").stop(false, false).slideUp(); hjDD.removeClass("on"); $navMobile.slideUp(); } else { $navA.parents('li').removeClass("on"); $mSubnav.stop(false, false).slideUp(); hjDD.find(".menufix").stop(false, false).slideDown(); hjDD.addClass("on"); e.preventDefault(); } } }); getHash(); jQuery(".strategy-info a,.meundown li a,.menu-leval li a").click(function(e){ var hash=jQuery(this).attr("href").split("#")[1]; if(hash && jQuery("#"+hash).length==1){ e.preventDefault(); setScroll("#"+hash); } $(".menubox").fadeOut(); $(".menu").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},1000,'easeInOutExpo'); }; $('.backtop').click(function(e){ e.preventDefault(); jQuery("html,body").animate({ scrollTop: 0}, 600, 'easeInOutExpo'); }); setPopUp($('.weix'), "微信公众号"); 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 }); }; };