$(document).ready(function(){ //首页搜索效果 $("#searchbtn").on("click", function(e){ $("#searchinput").animate({width:"150px"},250); $("#search").css("border","1px solid #ccc"); $("#search").animate({width:"190px"},250); var btntime=settimeout(function(){ console.log(document.getelementbyid("searchbtn").type); searchbtn.type="submit"; },500); $(document).one("click", function(){ $("#searchinput").animate({width:"0"},200); $("#search").animate({width:"34px"},200); searchbtn.type="button"; $("#search").css("border","1px solid #fff"); }); e.stoppropagation(); }); $("#searchinput").on("click", function(e){ e.stoppropagation(); }); // 二级分类显示隐藏方法 tilclass:有二级菜单的一级li的class/id number:执行mouseover 1/click 2 //sonliheight:每个子li的高 sonulboxheight:子ul的padding/margin/border function childul(tilclass,number,sonliheight,sonulboxheight){ // 导航二级分类 // 获取有二级ul的li标签 var navli = $(tilclass),i,len; var flag = true; // var event = event || window.event; //遍历li标签在鼠标事件添加效果 if(number === 1){ for(i = 0,len = navli.length;i= 750){ childul(".sonul",1,30,10); childul(".productul",1,35,0); } childul(".appsul",3,35,0); //首页底部导航动画 if(document.body.clientwidth < 750){ childul(".footerul",2,26,0); childul(".productul",3,35,0); } //首页等高 if(document.body.clientwidth >750 ) { // //改变页面宽度自动刷新页面 // $(window).resize(function(){ // location.reload(); // }); eleheight("ele"); } //导航条 navtab("#headerbtn","#nav",35); if(document.body.clientwidth >= 750){ $(".toggle").on("mouseover",function(){ $(this).children("ul").stop().show(250); }); $(".toggle").on("mouseout",function(){ $(this).children("ul").stop().hide(200); }); }else if(document.body.clientwidth < 750){ $(".toggle").on("click",function(){ $(this).next("ul").stop().slidetoggle(200); }); } });