var userAgent = navigator.userAgent.toLowerCase(); window.browser = { version: (userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/) || [])[1], safari: /webkit/.test(userAgent), opera: /opera/.test(userAgent), msie: /msie/.test(userAgent) && !/opera/.test(userAgent), mozilla: /mozilla/.test(userAgent) && !/(compatible|webkit)/.test(userAgent) }; if(browser.msie){ if(parseInt(browser.version) < 9 ) alert("为了获得更好的浏览体验,请升级浏览器!"); } $(function() { var userAgent = navigator.userAgent.toLowerCase(); // Figure out what browser is being used jQuery.browser = { version: (userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/) || [])[1], safari: /webkit/.test(userAgent), opera: /opera/.test(userAgent), msie: /msie/.test(userAgent) && !/opera/.test(userAgent), mozilla: /mozilla/.test(userAgent) && !/(compatible|webkit)/.test(userAgent) }; // check placeholder browser support if ($.browser.msie&&($.browser.version == "9.0" || $.browser.version == "8.0")) { // set placeholder values $(this).find('[placeholder]').each(function() { if ($(this).val() == '') // if field is empty { $(this).val( $(this).attr('placeholder') ); } }); // focus and blur of placeholders $('[placeholder]').focus(function() { if ($(this).val() == $(this).attr('placeholder')) { $(this).val(''); $(this).removeClass('placeholder'); } }).blur(function() { if ($(this).val() == '' || $(this).val() == $(this).attr('placeholder')) { $(this).val($(this).attr('placeholder')); $(this).addClass('placeholder'); } }); // remove placeholders on submi $('[placeholder]').closest('form').submit(function() { $(this).find('[placeholder]').each(function() { if ($(this).val() == $(this).attr('placeholder')) { $(this).val(''); } }) }); } }); var TopMenu=function() { var $TopmenuChildren = $(".topmenu-children"), topmenuTimerout = 0; var Method={ topMenuItemIn:function(){ var $this = $(this), childrenText = $this.children("dl").html(); if(!childrenText) { return; } Method.clearTimerOut(); if(!$TopmenuChildren.attr("text") != $this.children("a").text()) { $TopmenuChildren.attr("text",$this.children("a").text()); $TopmenuChildren.empty().html("
"+childrenText+"
"); } if(!$this.attr("childrenWidth")) { var childrenWidth = 0; $TopmenuChildren.children("dl").children("dd").each(function(){ childrenWidth += $(this).innerWidth(); }) $this.attr("childrenWidth", childrenWidth); } Method.measure($this.offset().left, $this.innerWidth(), $this.attr("childrenWidth")); Method.show(); }, topMenuItemOut:function(){ topmenuTimerout = setTimeout(Method.hide,30); }, show:function(){ $TopmenuChildren.stop(true).animate({"height":55}); }, hide:function(){ $TopmenuChildren.stop(true).animate({"height":0}) }, clearTimerOut:function(){ clearTimeout(topmenuTimerout); }, measure:function(topMenuOffsetLeft, topMenuWidth, childrenWidth){ $TopmenuChildren.children("i").css("left",topMenuOffsetLeft+topMenuWidth*0.5-10); //判断是否 //$TopmenuChildren.children("dl").css("padding-right",0); var pl = topMenuOffsetLeft-childrenWidth*0.5+topMenuWidth*0.5 ; var dll = $TopmenuChildren.children("dl").width(); if((parseFloat(pl) + parseFloat(childrenWidth)) > parseFloat(dll)){ pl = parseFloat(dll) - parseFloat(childrenWidth); } $TopmenuChildren.children("dl").css("padding-left",pl); } } //一级菜单 $(".topmenu-ul li").hover(Method.topMenuItemIn, Method.topMenuItemOut); //二级菜单 $TopmenuChildren.hover(Method.clearTimerOut, Method.hide); }(); var HeaderScroll=function() { var $HeaderMenu = $(".topmenu"); var $Body = $("#scroll-body"); var $Header = $("#header-top"); if($Body.length == 0){ return; } var Script=function() { var scrollTop = $(document).scrollTop(); $HeaderMenu.css("top",scrollTop<=33 ? 33-scrollTop : 0); $Header.css("top",-scrollTop); if(scrollTop == 0){ $HeaderMenu.removeClass("shadow"); $Body.css("z-index",0); }else{ if(!$HeaderMenu.hasClass("shadow")){ $HeaderMenu.addClass("shadow"); $Body.css("z-index",0); } } }; Script(); $(window).scroll(Script); }(); var Tabs=function(){ var $Tabs = $(".--tabs .--tabs-tag"); $Tabs.click(function(){ var $this = $(this), $tabsTags = $this.parents(".--tabs").children(".--tabs-tag"); $tabsTags.removeClass("select"); for(var i=0;i<$tabsTags.length;i++){ $($tabsTags[i].getAttribute("content")).removeClass("-show"); } $(this.getAttribute("content")).addClass("-show"); $this.addClass("select"); }) }(); var ScrollNews=function(timer){ if($("#scroll-news").length==0 || $("#scroll-news").children("li").length<=1){ return; } var $ScrollNews = $("#scroll-news"), len = $ScrollNews.children("li").length*2, $currentTag = $("#scroll-tag i"), scrollCount = 0, interval = 0; $ScrollNews.append($ScrollNews.html()); $ScrollNews.css("width", len*325); var stop = function(){ clearInterval(interval); } var start = function(){ stop(); interval = setInterval(scroll, timer); } var scroll = function(dif) { scrollCount++; if(scrollCount == 4){ scrollCount = 1; $ScrollNews.css("margin-left",0); } $ScrollNews.animate({"margin-left": scrollCount*-325 }); //标记 $currentTag.removeClass("current"); $($currentTag.get(scrollCount == 3 ? 0 : scrollCount)).addClass("current"); } $ScrollNews.hover(stop,start); start(); $currentTag.hover(function(){ $ScrollNews.animate({"margin-left": $currentTag.index(this)*-325 }); $currentTag.removeClass("current"); $(this).addClass("current") },function(){ }) }(4000); $(function(){ $(".prev,.next").hover(function(){ $(this).stop(true,false).fadeTo("show",0.9); },function(){ $(this).stop(true,false).fadeTo("show",0.4); }); $(".banner-box").slide({ titCell:".hd ul", mainCell:".bd ul", effect:"fold", interTime:3500, delayTime:500, autoPlay:true, autoPage:true, trigger:"click" }); $(".serviceGuidh").click(function () { if($(this).is(".active")){ $(".serviceGuidh").removeClass("active"); }else { $(".serviceGuidh").addClass("active"); } }) })