vivo_uimix = { init : function(){ var headbox=$("#vivo-head"), navbox=headbox.find(".vivo-nav"), searchbox=headbox.find(".vivo-search"), searchinput=searchbox, searchbtn=navbox.find(".search-user a.search"), closesearchbtn=searchbox.find("a.close"), issearchclose=true, ismenuenter=iscommenter=false; closesearchbtn.css({opacity:0}); searchbox.on({ mouseenter : function(){ closesearchbtn.animate({opacity:1},300); }, mouseleave : function(){ closesearchbtn.animate({opacity:0},300); } }); searchbtn.on("click",function(){ if(issearchclose){ searchbox.children().css({opacity:0}); searchbox.css({display:"block",height:0}).stop().animate({height:300},300); searchbox.children().stop().delay(300).animate({opacity:1},500); searchinput.focus().val(""); $(this).addclass("current"); issearchclose=false; }else{ searchbox.stop().animate({height:0},300,function(){ $(this).css({display:"none"}); issearchclose=true; }); $(this).removeclass("current"); } return false; }); closesearchbtn.on("click",function(){ searchbtn.click(); return false; }); } }; $(document).ready(function() {vivo_uimix.init()});