$(function () { $('.gn-list >li').hover( function () { $(this).addClass("active"); var current_li = $(this); if (!$(current_li).children('.dropdown').is(':visible') && $('.dropdown').find('a').length > 0) { $(current_li).find('.dropdown').slideDown(200); } } , function () { $(this).find('.dropdown').slideUp(100); $(this).removeClass("active"); }); $(".menu").hover(function () { $(this).find(".menu-bd").show(); $(this).addClass("menu-hover"); }, function () { $(this).find(".menu-bd").hide(); $(this).removeClass("menu-hover"); }); $(".serchinco").click(function(){ $(".globalsearch").slideToggle(500); }); if($('.btn_jt')){ $(".btn_jt").click(function () { if ($(this).hasClass("cur")) { $(".sunnav").slideUp(); $(this).removeClass("cur"); } else { $(".sunnav").slideDown(); $(this).addClass("cur"); } }); } SetdropdownLeft(); $(window).resize(function () { SetdropdownLeft(); }); //导航当前样式 var cururl=window.location.href.toLowerCase(); if(cururl.indexOf("about")>-1||cururl.indexOf("course")>-1){ $(".gn-list >li:eq(1)").find("a:eq(0)").addClass("active1"); } else if(cururl.indexOf("news")>-1){ $(".gn-list >li:eq(2)").find("a:eq(0)").addClass("active1"); } else if(cururl.indexOf("proc")>-1||cururl.indexOf("prolist")>-1||cururl.indexOf("prodetails")>-1){ $(".gn-list >li:eq(3)").find("a:eq(0)").addClass("active1"); } else if(cururl.indexOf("markservice")>-1||cururl.indexOf("project")>-1){ $(".gn-list >li:eq(4)").find("a:eq(0)").addClass("active1"); } else if(cururl.indexOf("culture")>-1){ $(".gn-list >li:eq(5)").find("a:eq(0)").addClass("active1"); } else if(cururl.indexOf("rlzy")>-1||cururl.indexOf("careers")>-1||cururl.indexOf("job")>-1||cururl.indexOf("welfare")>-1){ $(".gn-list >li:eq(6)").find("a:eq(0)").addClass("active1"); } else if(cururl.indexOf("contact")>-1){ $(".gn-list >li:eq(7)").find("a:eq(0)").addClass("active1"); } else{ $(".gn-list >li:eq(0)").find("a:eq(0)").addClass("active1"); } }) function slides() { if ($(window).width() < 641) { $(".banner .mpic img").each(function (index, element) { var mobimg = $(this).attr("data"); $(this).attr("src", mobimg); }); } else { $(".banner .pic img").each(function (index, element) { var pcimg = $(this).attr("data"); $(this).attr("src", pcimg); }); } } function Sto(id){ $("html,body").animate({scrollTop: $('#'+id).offset().top-150}, 1000); return false;// 返回false可以避免在原链接后加上# } function autoHideBox(tit,con){ if(tit=='') tit="提示"; $('#mask-dialogBox').dialogBox({ hasClose: true, hasMask: true, autoHide: true, time: 3000, title:tit, content: con }); } function isWeiXin() { var ua = window.navigator.userAgent.toLowerCase(); if (ua.match(/MicroMessenger/i) == 'micromessenger') { return true; } else { return false; } } function popupDiv(div_id) { //根据自己需求注意宽度和高度的调整 var iWidth = document.documentElement.clientWidth; var iHeight = document.documentElement.clientHeight; //遮罩层 var bgObj = document.createElement("div"); bgObj.setAttribute("id", "bgObj"); //设置ID bgObj.setAttribute("onclick", "hideDiv('" + div_id + "')"); bgObj.style.cssText = "position:absolute;left:0px;top:0px;width:" + Math.max(document.body.scrollWidth, iWidth) + "px;height:" + Math.max(document.body.scrollHeight, iHeight) + "px;filter:Alpha(Opacity=30);opacity:0.1;background-color:#000000;z-index:20000;"; document.body.appendChild(bgObj); var div_obj = $("#" + div_id); var windowWidth = document.documentElement.clientWidth; var windowHeight = document.documentElement.clientHeight; var popupHeight = div_obj.height(); var popupWidth = div_obj.width(); //添加并显示遮罩层 //$("
").addClass("overlap") //.width(windowWidth * 0.99) //.height(windowHeight * 0.99) //.click(function() {hideDiv(div_id); }) //.appendTo("body") //.fadeIn(200); div_obj.fadeIn(500); div_obj.css({ "position": "fixed", "z-index": "30000", "left": windowWidth / 2 - popupWidth / 2, "top": windowHeight / 2 - popupHeight / 2 }).animate({ opacity: "show" }, "slow"); } function hideDiv(div_id) { $("#bgObj").remove(); //$("#mask").remove(); $("#" + div_id).fadeOut(500); } function SetdropdownLeft(){ if($(window).width()>767){ $(".gn-list >li").each(function(i,o){ $(o).find(".dropdown").attr("w",$(o).find(".dropdown").width()); $(o).attr("w",$(o).width()); $(o).find(".dropdown").css("margin-left",($(o).width()-$(o).find(".dropdown").width()-40)/2); }); }else{ $(".gn-list .dropdown").removeAttr("style"); } } //$(function () { // if($(window).width() > 641){ // $(document).scroll(function(){ // if($(document).scrollTop()>140){ // $("#globalnav").addClass("mini_top")// // }else{ // $("#globalnav").removeClass("mini_top") // } // }) // } //})