jQuery带tab切换搜索框样式代码
效果体验:http://hovertree.com/texiao/jquery/23/
代码如下,保存到HTML文件也可以查看效果:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
* {
margin: 0;
padding: 0;
list-style: none;
} .search-hovertree-form {
width: 575px;
margin: 100px auto;
overflow: hidden;
} .search-hovertree-form .search-bd {
height: 25px;
} .search-hovertree-form .search-bd li {
font-size: 12px;
width: 60px;
height: 25px;
line-height: 25px;
text-align: center;
float: left;
cursor: pointer;
background-color: #eee;
color: #666;
} .search-hovertree-form .search-bd li.selected {
color: #fff;
font-weight: 700;
background-color: #B61D1D;
} .search-hovertree-form .search-hd {
height: 34px;
background-color: #B61D1D;
padding: 3px;
position: relative;
} .search-hovertree-form .search-hd .search-hovertree-input {
width: 490px;
height: 22px;
line-height: 22px;
padding: 6px 0;
background: none;
text-indent: 10px;
border: 0;
outline: none;
position: relative;
left: 3px;
top: 0;
z-index: 5;
#margin-left:-10px;
} .search-hovertree-form .search-hd .btn-search {
width: 70px;
height: 34px;
line-height: 34px;
position: absolute;
right: 3px;
top: 3px;
border: 0;
z-index: 6;
cursor: pointer;
font-size: 12px;
color: #fff;
font-weight: 700;
background: none;
outline: none;
} .search-hovertree-form .search-hd .pholder {
display: inline-block;
padding: 2px 0;
font-size: 12px;
color: #999;
position: absolute;
left: 13px;
top: 11px;
z-index: 4;
background: url(http://hovertree.com/texiao/jquery/23/images/zoom.jpg) no-repeat 0 0;
padding-left: 25px;
top:11px;
} .search-hovertree-form .search-hd .s2, .search-hovertree-form .search-hd #s2 {
display: none;
} .search-hovertree-form .search-bg {
width: 495px;
height: 34px;
background-color: #fff;
position: absolute;
left: 3px;
top: 3px;
z-index: 1;
}a{color:blue}
</style><meta charset="UTF-8">
<title> jQuery搜索切换 - 何问起</title><base target="_blank" />
</head>
<body> <div class="search-hovertree-form">
<div id="search-bd" class="search-bd">
<ul>
<li class="selected">找商品</li>
<li>找商家</li>
</ul>
</div>
<div id="search-hd" class="search-hd">
<div class="search-bg"></div>
<input type="text" id="s1" class="search-hovertree-input">
<input type="text" id="s2" class="search-hovertree-input">
<span class="s1 pholder">食品酒水半价抢疯</span>
<span class="s2 pholder">搜商家名称</span>
<button id="submit" class="btn-search" value="搜索">搜索</button>
</div>
</div>
<div style="text-align:center;clear:both;margin-top:10px">
<a href="http://hovertree.com/">首页</a> <a href="http://hovertree.com/texiao/">特效</a>
<a href="http://hovertree.com/menu/jquery/">jQuery</a>
<a href="http://hovertree.com/h/bjae/6no8y0fm.htm">原文</a>
<a href="http://hovertree.com/map/">导航</a>
</div>
<script type="text/javascript" src="http://hovertree.com/ziyuan/jquery/jquery-1.11.3.min.js"></script>
<script type="text/javascript">
$(function(){
//通用头部搜索切换
$('#search-hd .search-hovertree-input').on('input propertychange',function(){
var val = $(this).val();
if(val.length > 0){
$('#search-hd .pholder').hide(0);
}else{
var index = $('#search-bd li.selected').index();
$('#search-hd .pholder').eq(index).show().siblings('.pholder').hide(0);
}
})
$('#search-bd li').click(function(){
var index = $(this).index();
$('#search-hd .pholder').eq(index).show().siblings('.pholder').hide(0);
$('#search-hd .search-hover'+'tree-input').eq(index).show().siblings('.search-hovertree-input').hide(0);
$(this).addClass('selected').siblings().removeClass('selected');
$('#search-hd .search-hovertree-input').val('');
});
})
</script>
</body>
</html>
更多: http://www.cnblogs.com/jihua/p/webfront.html
jQuery带tab切换搜索框样式代码的更多相关文章
- 仿淘宝TAB切换搜索框
<div class="search"> <div id="searchBox"> <ul class="tab-bar ...
- bootstrap搜索框样式代码及效果
<div class="container"> <div class="input-group"> <input type=&qu ...
- jquery实现tab切换完整代码
代码如下,保存到html文件打开: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " ...
- iOS开发UI篇 -- UISearchBar 属性、方法详解及应用(自定义搜索框样式)
很多APP都会涉及到搜索框,苹果也为我们提供了默认的搜索框UISearchBar.但实际项目中我们通常需要更改系统默认搜索框的样式.为了实现这一目标,我们需要先搞懂 UISearchBar 的属性及方 ...
- easyui easyui-accordion的使用和在tab切换时没有样式
1.easyui-accordion的使用 <div id="aa" class="easyui-accordion" style="width ...
- 好看css搜索框样式_分享8款纯CSS搜索框
最简单实用的CSS3搜索框样式,纯CSS效果无需任何javascript,其中部分搜索框在点击的时候有动画特效,搜索框的应用也是比较普通的,效果如下: 设计网站大全https://www.wode00 ...
- JQuery实现tab切换
JQuery实现tab切换: (jquery需要自己添加) <!DOCTYPE html> <html lang="en"> <head> &l ...
- 第二百一十节,jQuery EasyUI,SearchBox(搜索框)组件
jQuery EasyUI,SearchBox(搜索框)组件 学习要点: 1.加载方式 2.属性列表 3.方法列表 本节课重点了解 EasyUI 中 SearchBox(搜索框)组件的使用方法,这个组 ...
- react 实现tab切换 三角形筛选样式
这次使用的是react的class 类组件 import React, { Component } from 'react' import { LeftOutline, SearchOutli ...
随机推荐
- js修改后没反应-看看是不是取的缓存
- Sql Server系列:Transact-SQL变量
变量是Transact-SQL中由用户定义.可对其赋值并参与运算的一个实体,分为全局变量和局部变量.其中全局变量由系统自定义并维护,全局变量名称前面有@@字符,任何程序均可随时调用.局部变量名称前面有 ...
- Web APi之Web Host消息处理管道(六)
前言 我们知道Web API本身是无法提供请求-响应的机制,它是通过Web Host以及Self Host的寄宿的宿主方式来提供一个请求-响应的运行环境.二者都是将请求和响应抽象成HttpRespon ...
- C#互斥体——Mutex
Mutex对象是一个同步基元,可以用来做线程间的同步. 若多个线程需要共享一个资源,可以在这些线程中使用Mutex同步基元.当某一个线程占用Mutex对象时,其他也需要占用Mutex的线程将处于挂起状 ...
- IO多路复用之poll总结
1.基本知识 poll的机制与select类似,与select在本质上没有多大差别,管理多个描述符也是进行轮询,根据描述符的状态进行处理,但是poll没有最大文件描述符数量的限制.poll和selec ...
- TeamCity : 安装 Server
本文介绍在 Ubuntu Server 14.04 中安装 TeamCity Server 10.0.1.Ubuntu Server 上已经创建了用户 tcuser.TeamCity 的安装包为 T ...
- jQuery简洁大方的登录页面模板
jQuery+CSS网站登录模板本模板带验证码 在线体验:http://hovertree.com/texiao/jquery/13.htm Demo 2:http://hovertree.com/h ...
- [Q&A] 应用程序清单生成失败
当在 Silverlight 客户端属性里(如下图),添加"允许在浏览器外运行应用程序"和"在浏览器内运行时需要提升的信任"时, 图1 目录下会自动生成如下两个 ...
- jquery制作论坛或社交网站的每天打卡签到特效
效果:http://hovertree.com/texiao/jquery/50/ 现在许多社区,购物等网站都设置签到功能,打开可以收获经验.虚拟币等,提高用户粘性,增加浏览量,是一个不错的功能.本文 ...
- 自定义MVC框架
我们在学习自定义MVC框架的时候常常会听到Model1 ,Model2和MVC.那么什么是Model1 什么是Model2什么又是MVC呢? 什么是Model1? Model1就是一种纯jsp开发技术 ...