码迷,mamicode.com
首页 > 其他好文 > 详细

bootstrap---treeview使用方法

时间:2016-08-02 21:06:01      阅读:1834      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!