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 ...
随机推荐
- Publication的 immediate_sync 属性
Publication的属性 immediate_sync 控制 Snapshot 文件的创建,如果属性 immediate_sync设置为true,那么snapshot file在snapshot ...
- webpack + vuejs 基本配置(一)
开始之前 本文包含以下技术,文中尽量给与详细的描述,并且附上参考链接,读者可以深入学习: 1.webpack2.Vue.js3.npm4.nodejs —- 这个就不给连接了,因为上面的连接都是在你实 ...
- SQL Server中In-Flight日志究竟是多少
在SQL Server中,利用日志的WAL来保证关系数据库的持久性,但由于硬盘的特性,不可能使得每生成一条日志,就直接向磁盘写一次,因此日志会被缓存起来,到一定数据量才会写入磁盘.这部分已经生 ...
- XenServer pool 移除server 设置master
如果因为Pool中Master主机由于某种原因导致失效,会引起整个Pool进入紧急模式,恢复步骤如下: 在成员服务器上输入如下命令 # xe host-emergency-ha-disable ...
- 如何使用免费PDF控件从PDF文档中提取文本和图片
如何使用免费PDF控件从PDF文档中提取文本和图片 概要 现在手头的项目有一个需求是从PDF文档中提取文本和图片,我以前也使用过像iTextSharp, PDFBox 这些免费的PD ...
- C语言 第二章 数据类型、变量和输入函数
一.数据类型简介 在 C 语言中,数据类型指的是用于声明不同类型的变量或函数的一个广泛的系统.变量的类型决定了变量存储占用的空间,以及如何解释存储的位模式. 类型转换: 类型 存储大小 值范围 cha ...
- 使用canvas截图或者改变灰度
简述 html5新添加的canvas API可以让我们对画布进行开发应用,典型的是可以使用canvas截图或者 手工绘制“迷你图”(即嵌入在文本中的高清小图片). 实现截图的方法很简单,就是创建一个c ...
- 探秘Tomcat——连接篇
前两篇我们分别粗线条和细粒度的讲解了tomcat的服务是如何启动以及连接器Connector和容器Container又分别是如何被启动的. 本篇我们主要侧重tomcat中server.service以 ...
- L2/L3/L4 Switch简介
第二层交换机,是根据第二层数据链路层的MAC地址和通过站表选择路由来完成端到端的数据交换的.因为站表的建立与维护是由交换机自动完成,而路由器又是属于第三层设备,其寻址过程是根据IP地址寻址和通过路由表 ...
- Openfire 4.1.0
http://www.igniterealtime.org/downloads/index.jsp 服务器端口 接口 端口 类型 描述 所有的地址 5222 客户端到服务器 客户端使用标准端口连接 ...