基于bootstrap面板的类别多选栏
1、html部分
<div class="panel panel-default">
<div class="panel-heading">请选择您需要的分类(可多选)</div>
<div class="list-group" id="category">
<a href="#" class="list-group-item"><span class="glyphicon glyphicon-ok" ></span><p>前端</p></a>
<a href="#" class="list-group-item"><span class="glyphicon glyphicon-ok" ></span><p>后台</p></a>
<a href="#" class="list-group-item"><span class="glyphicon glyphicon-ok" ></span><p>iOS</p></a>
<a href="#" class="list-group-item"><span class="glyphicon glyphicon-ok" ></span><p>java</p></a>
<a href="#" class="list-group-item"><span class="glyphicon glyphicon-ok" ></span><p>测试</p></a>
<a href="#" class="list-group-item" id="newCategory"><span class="glyphicon glyphicon-ok " ></span>
<p>自定义</p>
<div >
<input style="position:relative;width:70%;float:left;" type="text" maxlength="10" placeholder="请输入要添加的类别" class="form-control" name="" >
<button style="float:right;" class="btn btn-primary">添加</button>
</div>
</a>
</div>
<button style="width:30%; float:right;margin-top: 15px;" id="returnNewTask" class="btn btn-success">确定</button>
</div>
2、js
//类别多选栏的样式(小绿勾)
var $category = $("#category");
$category.delegate("a", "click", function (e) {
if ($(this).index() == $("#category a").length - 1) {
$('#newCategory div').css("display", "block");
}
else {
$('#newCategory div').css("display", "none");
$("#newCategory input").val("");
if ($(this).is(".active")) {
$(this).removeClass("active");
}
else {
$(this).addClass("active");
}
;
}
}); $("#newCategory button").on("click", function () {
var item = '<a href="#" class="list-group-item active"><span class="glyphicon glyphicon-ok" ></span><p>' +
$("#newCategory input").val() + '</p></a>';
$("#newCategory").before(item);
$("#newCategory input").val("");
})
3、css
/*******类别多选栏的部分******/
#category .active{
background-color: white;
color: black;
border: 1px solid #E2E2E3;
} #category .badge{
margin-top: -4px;
background-color:transparent;
border: none;
} #category span{
float:right;
display:none;
} #category .active span{
display:block;
float:right;
color: rgb(70, 176, 85);
font-size: 15px;
} #options a{
overflow: hidden;
} #options .panel{
width:100%;
margin-left: auto;
margin-right: auto;
} #newCategory div{
display: none;
}
基于bootstrap面板的类别多选栏的更多相关文章
- 基于Bootstrap、Jquery的自适应导航栏
css代码: .kch_nav{width: 100%; position: fixed;z-index: 999;top:0;left: 0;right: 0;height: 69px;backgr ...
- 基于bootstrap的select(可多选)
如图:
- 后台管理-基于 Bootstrap 开发的网站后台管理面板
Bootstrap 开发框架真的很强大,今天推荐几个非常不错的基于 Bootstrap 开发的网站后台管理面板,全部都是响应式布局,细节做得都很不错.可以搜索keenthemes. Metronic ...
- 8个强大的基于Bootstrap的CSS框架
做过前端开发的小伙伴们应该对Bootstrap不会陌生,它是由Twitter推出的开源CSS框架,其中包含了很多Web前端开发的工具包和应用组件.当然,和jQuery一样,Bootstrap同时也是一 ...
- 基于Bootstrap仿淘宝分页控件实现
.header { cursor: pointer } p { margin: 3px 6px } th { background: lightblue; width: 20% } table { t ...
- Metronic – 超赞!基于 Bootstrap 的响应式后台管理模板
Metronic 是一套精美的响应式后台管理模板,基于强大的 Twitter Bootstrap 框架实现.Metronic 拥有简洁优雅的 Metro UI 风格界面,6 种颜色可选,76 个模板页 ...
- 基于Bootstrap的超酷jQuery开关按钮插件
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJgAAAA2CAIAAAC0tsfoAAAB/0lEQVR4nO3bQWrCQBTGcc/mbVz0DD
- 基于 Bootstrap 的扁平化 UI 开发包
Flat UI是一款基于Bootstrap的扁平化前端UI工具包,Flat UI的组件外观设计非常清新和漂亮,Flat UI的组件包含按钮,输入框,组合按钮,复选框,单选按钮,标签,菜单,进度条和滑块 ...
- 基于Bootstrap设计网页
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding= ...
随机推荐
- php拓展ssh功能
1.下载拓展ssh需要的两个软件包,libssh2和ssh2. libssh2下载地址:http://pan.baidu.com/s/1hq7XOhu libssh2官网下载地址:http://www ...
- 高人ozhy111提供的下载资源
特别是有很多手机方面的独创源代码,先记下来,有空挨个看一遍: http://download.csdn.net/user/ozhy111 比如:idtcpserver文件传输xe7PC端及手机端 ht ...
- ruby迭代器iterator和枚举器Enumerator
编写自定义的迭代器 The defining feature of an iterator method is that it invokes a block of code associatedwi ...
- C++解析JSON之JsonCPP
一.JSON简介 JSON全称为JavaScript ObjectNotation,它是一种轻量级的数据交换格式,易于阅读.编写.解析. JSON由两种基本结构构成: )"名称/值" ...
- Learning WCF Chapter1 Generating a Service and Client Proxy
In the previous lab,you created a service and client from scratch without leveraging the tools avail ...
- WCF Host中的BaseAddress 和 Endpoint中的Address的区别
http://stackoverflow.com/questions/18720810/wcf-service-base-address-vs-endpoint-address baseAddress ...
- C# WinForm捕获未处理的异常
using System; using System.Collections.Generic; using System.Windows.Forms; using System.IO; namespa ...
- DBcontext应用于已存在数据库
转自:http://www.cnblogs.com/Tally/archive/2013/01/30/2882855.html EF4.1有三种方式来进行数据操作及持久化.分别是Database-Fi ...
- 正则表达式, 用于Delphi
表示不能为空 : [^\s]+ 只能输入数字和字母: ^[A-Za-z0-9]+$
- windows下Qt5.1 for android开发环境配置(PS:Qt5.2出来了哈,稳定)
说明:以下开发环境配置过程参考了这些文章: http://qt-project.org/wiki/building_qt-android_on_windows http://www.hyarm.com ...