$(function(){ $(window).scroll(function(event) { var top = $(this).scrollTop()||0; if( top >30){ $("#focus,.listpage").css("marginTop","160px"); $("#header").addClass('mini_header'); $("#nav").addClass('fixed_nav'); /*$("#header").css({ "position":"fixed", "top":0, "z-index":1005 }); $("#nav").css({ "position":"fixed", "top":70, "z-index":1005 });*/ }else{ $("#focus,.listpage").css("marginTop","0px"); $("#header").removeClass('mini_header'); $("#nav").removeClass('fixed_nav'); /*$("#header").css({ "position":"", "top": "" }); $("#nav").css({ "position":"", "top": "" });*/ } }); }); $(function(){ $("#keyword").css({"width":100,"overflow":"hiden"}); $(".wp_search").hover(function(){ $(".keyword", this).addClass("keyword-focus").stop().animate({"width":100}); var key = $.trim($(".keyword", this).val()); if(key==""){ $(".keyword", this).val("搜索"); } },function(){ var key = $.trim($(".keyword", this).val()); if(key=="搜索"){ $(".keyword", this).val(""); } if($(".keyword", this).val()==""){ $(".keyword", this).removeClass("keyword-focus").stop().animate({"width":100}); }else{ $(".keyword", this).addClass("keyword-focus"); } $(".keyword", this).trigger("blur"); }); $("#keyword").click(function(){ var key = $.trim($(this).val()); if(key=="搜索"){ $(this).val(""); } }); });