博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
bootstrap 树
阅读量:7075 次
发布时间:2019-06-28

本文共 2785 字,大约阅读时间需要 9 分钟。

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

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

源码:

css:

.tree {    min-height:20px;    padding:19px;    margin-bottom:20px;    background-color:#fbfbfb;    border:1px solid #999;    -webkit-border-radius:4px;    -moz-border-radius:4px;    border-radius:4px;    -webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.05);    -moz-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.05);    box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.05)}.tree li {    list-style-type:none;    margin:0;    padding:10px 5px 0 5px;    position:relative}.tree li::before, .tree li::after {    content:'';    left:-20px;    position:absolute;    right:auto}.tree li::before {    border-left:1px solid #999;    bottom:50px;    height:100%;    top:0;    width:1px}.tree li::after {    border-top:1px solid #999;    height:20px;    top:25px;    width:25px}.tree li span {    -moz-border-radius:5px;    -webkit-border-radius:5px;    border:1px solid #999;    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:0}.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:#000}

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();            });});

 

转载地址:http://fxdml.baihongyu.com/

你可能感兴趣的文章
09网易校园招聘笔试题
查看>>
。一个通俗易懂的HMM例子
查看>>
freeswitch 挂断前执行脚本
查看>>
EffectManager
查看>>
python packages prebuild for windows
查看>>
这样就算会了PHP么?-10
查看>>
远程调用WMI安装软件
查看>>
从零开始学习jQuery (七) jQuery动画-让页面动起来!
查看>>
asp.net 操作word
查看>>
SQL Server 权限管理
查看>>
郎意难坚,侬情自热(文/王路)
查看>>
Form_Form Builder开发基于视图页面和自动代码生成包(案例)
查看>>
Android SDK Manager 中如果没有相应的镜像ARM XX Image
查看>>
简单聊下Unicode和UTF-8
查看>>
ASP.NET Web API的Controller是如何被创建的?
查看>>
在 Azure 上使用 Docker运行 Mono
查看>>
(转)JITComplier、NGen.exe及.NET Native
查看>>
Ant build xml中的各种变量解释
查看>>
labview视频采集IMAdx
查看>>
Android:实现一种浮动选择菜单的效果
查看>>