http://jsfiddle.net/jhfrench/GpdgF/

把原文的i标签中的图标显示出来;

源码:

<div class="tree well">
<ul>
<li><span><i
class="glyphicon glyphicon-folder-open"></i> Parent</span> <a
href="">Goes somewhere</a>
<ul>
<li><span><i class="glyphicon glyphicon-minus"></i>Child</span>
<a href="">Goes somewhere</a>
<ul>
<li><span><i class="glyphicon glyphicon-leaf"></i>
Grand Child</span> <a href="">Goes somewhere</a></li>
</ul></li>
</ul></li>
<li><span><i class="icon-folder-open"></i> Parent2</span> <a
href="">Goes somewhere</a>
<ul>
<li><span><i class="icon-leaf"></i> Child</span> <a
href="">Goes somewhere</a></li>
</ul></li>
</ul>
</div>

css:

.tree {
min-height:20px;
padding:19px;
margin-bottom:20px;
background-color:#fbfbfb;
border:1px solid #;
-webkit-border-radius:4px;
-moz-border-radius:4px;
border-radius:4px;
-webkit-box-shadow:inset 1px 1px rgba(, , , 0.05);
-moz-box-shadow:inset 1px 1px rgba(, , , 0.05);
box-shadow:inset 1px 1px rgba(, , , 0.05)
}
.tree li {
list-style-type:none;
margin:;
padding:10px 5px 5px;
position:relative
}
.tree li::before, .tree li::after {
content:'';
left:-20px;
position:absolute;
right:auto
}
.tree li::before {
border-left:1px solid #;
bottom:50px;
height:%;
top:;
width:1px
}
.tree li::after {
border-top:1px solid #;
height:20px;
top:25px;
width:25px
}
.tree li span {
-moz-border-radius:5px;
-webkit-border-radius:5px;
border:1px solid #;
border-radius:5px;
display:inline-block;
padding:3px 8px;
text-decoration:none
}
.tree li.parent_li>span {
cursor:pointer
}
.tree>ul>li::before, .tree>ul>li::after {
border:
}
.tree li:last-child::before {
height:30px
}
.tree li.parent_li>span:hover, .tree li.parent_li>span:hover+ul li span {
background:#eee;
border:1px solid #94a0b4;
color:#
}

js:

$(function() {
$('.tree li:has(ul)').addClass('parent_li').find(' > span').attr('title',
'点击收缩');
$('.tree li.parent_li > span').on(
'click',
function(e) {
var children = $(this).parent('li.parent_li')
.find(' > ul > li');
if (children.is(":visible")) {
children.hide('fast');
$(this).attr('title', '点击展开').find(' > i').addClass(
'glyphicon-plus').removeClass('glyphicon-minus');
} else {
children.show('fast');
$(this).attr('title', '点击收缩').find(' > i').addClass(
'glyphicon-minus').removeClass('glyphicon-plus');
}
e.stopPropagation();
});
});

bootstrap 树的更多相关文章

  1. js插件---Bootstrap 树控件

    js插件---Bootstrap 树控件 一.总结 一句话总结:可以直接用gojs,或者搜索js,jquery的树控件,或者bootstrap树控件,一大堆 gojs 二.JS组件系列——Bootst ...

  2. JS组件系列——Bootstrap 树控件使用经验分享

    前言:很多时候我们在项目中需要用到树,有些树仅仅是展示层级关系,有些树是为了展示和编辑层级关系,还有些树是为了选中项然后其他地方调用选中项.不管怎么样,树控件都是很多项目里面不可或缺的组件之一.今天, ...

  3. Bootstrap树控件(Tree控件组件)使用经验分享

    前言:很多时候我们在项目中需要用到树,有些树仅仅是展示层级关系,有些树是为了展示和编辑层级关系,还有些树是为了选中项然后其他地方调用选中项.不管怎么样,树控件都是很多项目里面不可或缺的组件之一.今天, ...

  4. 基于bootstrap样式的tree,

    <!doctype html><html lang="zh"><head> <meta charset="UTF-8" ...

  5. JS组件系列——分享自己封装的Bootstrap树形组件:jqTree

    前言:之前的一篇介绍了下如何封装自己的组件,这篇再次来体验下自己封装组件的乐趣.看过博主博客的园友应该记得之前分享过一篇树形菜单的使用JS组件系列——Bootstrap 树控件使用经验分享,这篇里面第 ...

  6. UI 收集

    semantic http://www.semantic-ui.com.cn/modules/reveal.html sbadmin http://startbootstrap.com/templat ...

  7. Uber使用Swift重写APP的踩坑经历及解决方案(转载)

    本文出自Uber移动架构和框架组负责人托马斯·阿特曼于2016年在湾区Swift峰会上的演讲,分享了使用Swfit重写Uber的好与坏.以下为译文: 我是托马斯·阿特曼,目前是Uber移动架构和框架组 ...

  8. 15、使用ggtree实现进化树的可视化和注释(转载)

    本文作者:余光创,目前就读于香港大学公共卫生系,开发过多个R/Bioconductor包,包括ChIPseeker, clusterProfiler, DOSE,ggtree,GOSemSim和Rea ...

  9. iscroll.js的简单使用方法

    参考链接:https://www.cnblogs.com/Renyi-Fan/tag/js%E6%8F%92%E4%BB%B6/default.html?page=2 目录 一.总结 一句话总结:Sc ...

随机推荐

  1. 谈谈java的BlockingQueue

    http://www.cnblogs.com/archy_yu/archive/2013/04/19/3018479.html 博客园 首页 新随笔 联系 管理 随笔- 92  文章- 0  评论- ...

  2. Java中的构造方法

    什么是构造方法:每一个类中至少有一个构造方法,它用于创建该类对象,这个和OC中的init有异曲同工之妙. 构造方法的格式:A:方法名与类名相同  B:没有返回值类型,没有void C:没有具体的返回值 ...

  3. SVG页面loading动态图

    https://github.com/SamHerbert/SVG-Loaders demo http://samherbert.net/svg-loaders/

  4. AVR编程_如何通过软件复位AVR?(转)

    源:http://blog.sina.com.cn/s/blog_493520900100bpos.html Question 如何通过软件复位AVR? Answer 如果你想通过软件复位AVR,你应 ...

  5. CentOS x 64 MooseFS 学习

    一.MFS 简介.... MooseFS(Moose File System,mfs)是一种分布式文件系统,它将数据分布在网络中的 不同服务器上,支持FUSE,客户端可以作为一个 普通的Unix 文件 ...

  6. Arduino中hex文件的保存及应用(转)

    源:Arduino中hex文件的保存及应用 arduino在编译.链接.下载之后,hex文件自动删除了,造成软件仿真(如用proteus仿真)及其他单片机板应用的不便.以下是自己实践的小结,与大家分享 ...

  7. JS中Exception处理

    程序开发中,编程人员经常要面对的是如何编写代码来响应错误事件的发生,即例外处理(exception handlers).如果例外处理代码设计得周全,那么最终呈现给用户的就将是一个友好的界面.否则,就会 ...

  8. CI分页器pagination的原理及实现

    以下是本人原创,如若转载和使用请注明转载地址.本博客信息切勿用于商业,可以个人使用,若喜欢我的博客,请关注我,谢谢!博客地址 下面这段代码是从官网上翻译过来的,介绍了分页的用例 1 2 3 4 5 6 ...

  9. mysql表明保存不了,多了空格都不行啊

    mysql表明保存不了,多了空格都不行啊

  10. 史上最坑的证书报错解决方法:Code=3000 "未找到应用程序的“aps-environment”的权利字符串"

    在ios注册远程通知获取设备令牌token的时候 // 注册远程通知获取设备令牌 toKen [[ UIApplication sharedApplication ] registerForRemot ...