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. STM32开发指南-蜂鸣器实验

    另一种I/O作为输出的应用,利用一个I/O来控制板载的有源蜂鸣器,实现蜂鸣器控制. PS:有源蜂鸣器自带了震荡电路,一通电就会发声:无源蜂鸣器则没有自带震荡电路,必须外部提供2~5Khz左右的方波驱动 ...

  2. 手动启动Android模拟器

    1.5版本中加了个所谓的AVD(Android Virtual Device),AVD就相当于是一个模拟器的,不过你可以利用AVD创建基于不同版本的模拟器,然后使用emulator-avd avdNa ...

  3. margin 塌陷现象 与 注意事项

    1.在标准文档流中,块级标签之间竖直方向的margin会以大的为准,这就是margin的塌陷现象. 但是,脱标之后就不会出现margin的塌陷现象. 2.margin:0 auto;  会让盒子水平居 ...

  4. PHP 反射应用之一(插件框架)

    http://www.zui88.com/blog/view-205.html 反射,非常有用的一套东西,用来在运行时,分析代码,分析类的属性,方法,参数,实例化类,调用类的方法等等,从而实现框架,实 ...

  5. Inside dependency property

    依赖属性的定义,分为3步(以PresentationFramework中的System.Windows.Controls.Button为例) 1.  声明依赖属性 public static read ...

  6. Linux之特殊权限(SUID/SGID/SBIT)

    特殊权限的介绍 Set UID 当s这个标志出现在文件所有者的x权限上时,如/usr/bin/passwd这个文件的权限状态:“-rwsr-xr-x.”,此时就被称为Set UID,简称为SUID.那 ...

  7. CodeForces 622D Optimal Number Permutation

    是一个简单构造题. 请观察公式: 绝对值里面的就是 |di-(n-i)|,即di与(n-i)的差值的绝对值. 事实上,对于任何n,我们都可以构造出来每一个i的di与(n-i)的差值为0. 换句话说,就 ...

  8. (中等) UESTC 94 Bracket Sequence,线段树+括号。

    There is a sequence of brackets, which supports two kinds of operations. we can choose a interval [l ...

  9. 1227: [SDOI2009]虔诚的墓主人

    1227: [SDOI2009]虔诚的墓主人 Time Limit: 5 Sec  Memory Limit: 259 MBSubmit: 1083  Solved: 514[Submit][Stat ...

  10. leetcode--009 Linked List Cycle I

    aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZgAAACACAIAAAC5q+hAAAAJ+UlEQVR4nO2dwbXrKBJAOyelRShEQw