手机
当前位置:查字典教程网 >编程开发 >Javascript教程 >jQuery实现的类似淘宝网站搜索框样式代码分享
jQuery实现的类似淘宝网站搜索框样式代码分享
摘要:运行效果图:----------------------查看效果-----------------------小提示:浏览器中如果不能正常运...

运行效果图: ----------------------查看效果-----------------------

jQuery实现的类似淘宝网站搜索框样式代码分享1

jQuery实现的类似淘宝网站搜索框样式代码分享2

jQuery实现的类似淘宝网站搜索框样式代码分享3

小提示:浏览器中如果不能正常运行,可以尝试切换浏览模式。

为大家分享的类似淘宝网站搜索框样式代码如下

<head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>淘宝网选项卡类型搜索框样式代码</title> <script type="text/javascript" src="js/jquery-1.7.2.min.js"></script> <script type="text/javascript"> $(function(){ $(".bodys p").not(":first").hide(); $(".searchbox ul li").mouseover(function(){ var index = $(this).index(); if(index==0){ $(this).find("a").addClass("style1"); $("li").eq(1).find("a").removeClass("style2"); $("li").eq(2).find("a").removeClass("style3"); } if(index==1){ $(this).find("a").addClass("style2"); $("li").eq(0).find("a").removeClass("style1"); $("li").eq(2).find("a").removeClass("style3"); } if(index==2){ $(this).find("a").addClass("style3"); $("li").eq(0).find("a").removeClass("style1"); $("li").eq(1).find("a").removeClass("style2"); } var index=$(this).index(); $(".bodys p").eq(index).show().siblings().hide(); }); }); </script> <style type="text/css"> *{margin:0;padding:0;list-style-type:none;} a,img{border:0;} /* searchbox */ .searchbox{width:520px;height:80px;margin:40px auto 0 auto;} .searchbox ul{ height:35px; width:500px; list-style:none; margin-left:20px} .searchbox ul li{ float:left} .searchbox ul li a{ float:left; line-height:35px; padding:0 20px; text-decoration:none; color:#000; font-size:14px; font-weight:bold;} .searchbox ul li .style1{ background-color:#000; color:#fff} .searchbox ul li .style2{ background-color:#f00;color:#fff} .searchbox ul li .style3{ background-color:#F90;color:#fff} .bodys input{ height:30px;line-height:30px;width:390px;padding:0 10px;float:left;} .bodys .one{ border:#000 3px solid} .bodys .two{ border:#f00 3px solid} .bodys .three{ border:#F90 3px solid} .bodys .one1{ background-color:#000; } .bodys .two2{ background-color:#f00;} .bodys .three3{ background-color:#F90;} .bodys button{float:left;border:0;height:36px;width:100px; color:#FFF; line-height:36px;text-align:center;overflow:hidden;} </style> </head> <body> <div> <ul> <li><a href="#">宝贝</a></li> <li><a href="#">天猫</a></li> <li><a href="#">店铺</a></li> </ul> <div> <p><input type="text" value="" id="" placeholder="输入宝贝" /><button>搜索</button></p> <p><input type="text" value="" id="" placeholder="输入宝贝" /><button>搜索</button></p> <p><input type="text" value="" id="" placeholder="输入店铺" /><button>搜索</button></p> </div> </div> <divMicroSoft YaHei';"> </div> </body> </html>

以上就是为大家分享的jQuery实现的类似淘宝网站搜索框样式代码,希望大家可以喜欢。

【jQuery实现的类似淘宝网站搜索框样式代码分享】相关文章:

JavaScript实现Iterator模式实例分析

jQuery插件jRumble实现网页元素抖动

jQuery实现弹出窗口中切换登录与注册表单

JS实现跳转代码:多域名指向同一空间

jQuery实现不断闪烁文字的方法

jQuery实现自动滚动到页面顶端的方法

JQuery+CSS实现图片上放置按钮的方法

jQuery实现div随意拖动的实例代码(通用代码)

jQuery封装的tab选项卡插件分享

JavaScript实现身份证验证代码

精品推荐
分类导航