$(function() { $('.search input').bind('focus',function(){ $(this).parent().addclass("hover"); }); $('.search input').bind('blur',function(){ $(this).parent().removeclass("hover"); }); $('.input').bind('focus',function(){ $(this).addclass("hover"); }); $('.input').bind('blur',function(){ $(this).removeclass("hover"); }); var timeout = -1; $(".nav li").each(function(){ $(this).hoverdelay({ hoverevent:function(){ $(this).parent().find('li').removeclass('hover'); $(this).addclass('hover'); var i=$(".nav li").index(this)-1; if(i>=0){ $('#sub-nav div:eq('+i+')').addclass('hover'); }; cleartimeout(timeout); }, outevent: function(){ $(this).removeclass('hover'); timeout=settimeout(function(){ $('.nav .current').addclass('hover'); },200); var i=$(".nav li").index(this)-1; $('#sub-nav div:eq('+i+')').removeclass('hover'); } }); }) $('#sub-nav div').each(function(){ $(this).hoverdelay({ hoverevent:function(){ $(this).addclass('hover'); var i=$("#sub-nav div").index(this)+1; $('.nav li').removeclass('hover'); $('.nav li:eq('+i+')').addclass('hover'); cleartimeout(timeout); }, outevent: function(){ $(this).removeclass('hover'); var i=$("#sub-nav div").index(this)+1; $('.nav li:eq('+i+')').removeclass('hover'); timeout=settimeout(function(){ $('.nav .current').addclass('hover'); },200); } }); }) $('#page-top .sub-cate a').hover(function(){ $(this).parent().find('a').removeclass('hover'); $(this).addclass('hover'); cleartimeout(timeout); },function(){ if(!$(this).hasclass("current")){ $(this).removeclass('hover'); var timeout=settimeout(function(){ $('#page-top .sub-cate a.current').addclass('hover'); },200); } }) $('.form input').bind('focus',function(){ if($(this).val()==""){ $(this).next("label").hide(); } }); $('.form input').bind('blur',function(){ if(!$(this).val()){ $(this).next("label").show(); } }); $('.nav ul li').hover(function(){ $(this).find(".sub").slidedown(300); $(this).find(".sub-mask").slidedown(300); },function(){ $(this).find(".sub").slideup(200); $(this).find(".sub-mask").slideup(200); }) $("a.tab").hover(function () { $(this).parent().find("a.current").removeclass("current"); $(this).addclass("current"); for(var i=0;i<$(this).parent().find("a").length;i++){ $("#"+$(this).parent().find("a:eq("+i+")").attr("rel")).hide(); } $("#"+$(this).attr("rel")).show(); return false; }); $("a.tabs").click(function () { $(this).parent().find("a.current").removeclass("current"); $(this).addclass("current"); for(var i=0;i<$(this).parent().find("a").length;i++){ $("#"+$(this).parent().find("a:eq("+i+")").attr("rel")).hide(); } $("#"+$(this).attr("rel")).show(); return false; }); $(".back-top").click(function(){ $('html,body').animate({scrolltop: '0px'}, 400); return false; }) settimeout(function(){ if($('#follow-btn').length>0){ $('#follow-btn').css("bottom","132px"); } },1000); });