首页 > 其他 > 详细

bootstrap---treeview使用方法

时间:2016-08-02 21:03:10      阅读:746      评论:0      收藏:0      [点我收藏+]

1、html部分:

<div id="tree"></div>

2、css设置展开/收缩按钮图片:

.tree_arrows_down:before{
	content:url("../img/down.png");
}

.tree_arrows_right:before{
	content:url("../img/right.png");
}

3、js部分实现:

$(‘#tree‘).treeview({
	data: treeData,
	expandIcon: "tree_arrows_right",
	collapseIcon: "tree_arrows_down",
	levels : 3,
	onhoverColor: "#E8E8E8",
	showBorder: false,
	showTags: true,
	highlightSelected: true,
	highlightSearchResults:false,
	selectedBackColor: "#8D9CAA",
}); 

4、数据(treeData)格式:

var treeData =[
	{
		text: "第一中学",
		nodes: [
		{
			text: "高一年级",
			nodes: [
				{
					text: "一班",
					nodes: [
						{
							text: "三组",//
						}
					]
				}
			]
		},
		{
			text: "高二年级",
			nodes: [
				{
					text: "一班",
					nodes: [
						{
							text: "一组",
						}
					]
				}
			]
		},
		{
			text: "高三年级",
			nodes: []
		}
		]
	}	
];

5、样式展现:

技术分享

bootstrap---treeview使用方法

原文:http://www.cnblogs.com/hunterCecil/p/5730568.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!