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. 快速搭建本地HTTP服务器

    我们都知道,可以通过浏览器直接打开HTML文件来查看可视化的效果,但这种方式有一些局限性.比如我们在做手机端适配的时候,无法直接查看手机端的效果等.为了不受此类限制,强烈建议搭建一个本地的HTTP服务 ...

  2. Zencart 500错误查找和解决方法

    有时在一些虚拟主机下(如HostMonster,BlueHost),Zencart网站会莫名奇妙输出空白页面,查看HTTP头,其实可以看到是500错误.至于500错误的出现原因,一般是由于服务器脚本或 ...

  3. 树列复选框Extjs

    <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding= ...

  4. ecstore中kvstore之memcached

    memcached的安装 详细见 http://blog.csdn.net/motian06/article/details/17558831 memcached扩展的安装 详细见 http://bl ...

  5. Gson通过借助TypeToken获取泛型参数的类型的方法

    最近在使用Google的Gson包进行Json和Java对象之间的转化,对于包含泛型的类的序列化和反序列化Gson也提供了很好的支持,感觉有点意思,就花时间研究了一下. 由于Java泛型的实现机制,使 ...

  6. Java IO整理

    参考博客:http://www.cnblogs.com/rollenholt/archive/2011/09/11/2173787.html Java   IO体系结构 1.要弄清楚其体系结构,先明白 ...

  7. Nginx 虚拟主机下支持Pathinfo并隐藏入口文件的完整配置

    server { listen 80; server_name zuqiu.com; # 设置你的域名 index index.html index.htm index.php; root D:/wn ...

  8. 路过Haxe

    刚才在看Nape的时候,看到Haxe的代码,意外的感觉到亲切. 因为之前写过as2代码,最近学习了python,所以对haxe看起来很亲切,于是路过一下写了个HelloWorld. 另外,估计很长时间 ...

  9. 模块之dir函数

    dir()函数你可以使用内建的dir函数来列出模块定义的标识符.标识符有函数.类和变量.当你为dir()提供一个模块名的时候,它返回模块定义的名称列表.如果不提供参数,它返回当前模块中定义的名称列表. ...

  10. mysql面试

    第一方面:30种mysql优化sql语句查询的方法 避免全表扫描: 1.where 及 order by 上建立索引.2.避免在 where 子句中使用!=或<>操作符3. select ...