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" }); })