jQuery实现的类似淘宝网站搜索框样式代码分享_jquery
运行效果图: ----------------------查看效果-----------------------
小提示:浏览器中如果不能正常运行,可以尝试切换浏览模式。
为大家分享的类似淘宝网站搜索框样式代码如下
<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 class="searchbox"> <ul class="border1"> <li><a href="#" class="style1">宝贝</a></li> <li><a href="#">天猫</a></li> <li><a href="#">店铺</a></li> </ul> <div class="bodys"> <p><input type="text" value="" id="" class="one" placeholder="输入宝贝" /><button class="one1">搜索</button></p> <p><input type="text" value="" id="" class="two" placeholder="输入宝贝" /><button class="two2">搜索</button></p> <p><input type="text" value="" id="" class="three" placeholder="输入店铺" /><button class="three3">搜索</button></p> </div> </div> <div style="text-align:center;margin:50px 0; font:normal 14px/24px 'MicroSoft YaHei';"> </div> </body> </html>
以上就是为大家分享的jQuery实现的类似淘宝网站搜索框样式代码,希望大家可以喜欢。

热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

Video Face Swap
使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热门文章

热工具

记事本++7.3.1
好用且免费的代码编辑器

SublimeText3汉化版
中文版,非常好用

禅工作室 13.0.1
功能强大的PHP集成开发环境

Dreamweaver CS6
视觉化网页开发工具

SublimeText3 Mac版
神级代码编辑软件(SublimeText3)

热门话题

Python和JavaScript开发者的薪资没有绝对的高低,具体取决于技能和行业需求。1.Python在数据科学和机器学习领域可能薪资更高。2.JavaScript在前端和全栈开发中需求大,薪资也可观。3.影响因素包括经验、地理位置、公司规模和特定技能。

JavaScript是现代Web开发的基石,它的主要功能包括事件驱动编程、动态内容生成和异步编程。1)事件驱动编程允许网页根据用户操作动态变化。2)动态内容生成使得页面内容可以根据条件调整。3)异步编程确保用户界面不被阻塞。JavaScript广泛应用于网页交互、单页面应用和服务器端开发,极大地提升了用户体验和跨平台开发的灵活性。

如何在JavaScript中将具有相同ID的数组元素合并到一个对象中?在处理数据时,我们常常会遇到需要将具有相同ID�...

深入探讨console.log输出差异的根源本文将分析一段代码中console.log函数输出结果的差异,并解释其背后的原因。�...

实现视差滚动和元素动画效果的探讨本文将探讨如何实现类似资生堂官网(https://www.shiseido.co.jp/sb/wonderland/)中�...

学习JavaScript不难,但有挑战。1)理解基础概念如变量、数据类型、函数等。2)掌握异步编程,通过事件循环实现。3)使用DOM操作和Promise处理异步请求。4)避免常见错误,使用调试技巧。5)优化性能,遵循最佳实践。

探索前端中类似VSCode的面板拖拽调整功能的实现在前端开发中,如何实现类似于VSCode...
