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. 在CentOS中安装jenkins

    一.检查java是否安装 $ java -version java version "1.6.0_22" OpenJDK Runtime Environment (IcedTea6 ...

  2. angular中控制器之间的通讯方式

    1, 利用作用域的继承方式 由于作用域的继承是基于js的原型继承方式,所以这里分为两种情况,当作用域上面的值为基本类型的时候,修改父作用域上面的值会 影响到子作用域,反之,修改子作用域只会影响子作用域 ...

  3. (简单) CF 44D Hyperdrive,数学。

    In a far away galaxy there are n inhabited planets, numbered with numbers from 1 to n. They are loca ...

  4. dependency injection(2)

    https://segmentfault.com/a/1190000002424023

  5. 3D VR卡镜的使用方法

    先把它展开 然后把它卡在手机中间 介绍一个VR游戏资源 Chair In a Room,这是一个立体沉浸式的3D游戏,原理是陀螺仪传感器随着手机转动可以观察整个三维房间 如图所示,点击进入,将两眼放到 ...

  6. iOS9新特性-3D Touch

    本文主要讲解3DTouch各种场景下的开发方法,开发主屏幕应用icon上的快捷选项标签(Home Screen Quick Actions),静态设置 UIApplicationShortcutIte ...

  7. TimeDelta.total_seconds() in Python2.6-

    Python 的日期操作真是无力吐槽. 如果在做日期相加减时使用TimeDelta对象,2.7及以后的TimeDelta有total_seconds()方法获取总秒数,而2.6之前没有该方法,且众所周 ...

  8. ios系统 ipa文件 打包流程详解 及 常见问题处理

    注:先反省一下,原本打算一天一篇,每天进步一点点,但是最近变懒了,居然三天没有更新,在此告诫各位道友及我自己,程序员需戒欲,搞技术需持之以恒,不能三天打鱼,两天晒外. 现在步入主题,前段时间使用xco ...

  9. linux命令学习-2-dmesg

    DMESG NAME dmesg - print or control the kernel ring buffer(打印或者控制内核环缓冲) Usage: dmesg [options] Optio ...

  10. c++读取REG_MULTI_SZ类型注册表

    First: run RegQueryValueEx to get type and necessary memory size: Single byte code: DWORD type, size ...