首頁 >web前端 >Bootstrap教程 >bootstrap有樹狀選單嗎
bootstrap-treeview.js是一款強大的樹選單外掛程式,本文示範bootstrap-treeview.js的呼叫方法。
它可一次載入數據,也可非同步載入。支援Checkbox,selectable,節點級聯等,而且還能承載大數據。
使用方法(推薦學習:Bootstrap影片教學)
<!doctype html> <html> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>treeview+bootstrap多级下拉树插件</title> <link href="//cdn.bootcss.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet"> <style type="text/css"> .shouce-header{margin-bottom: 15px;font-family: "Segoe UI", "Lucida Grande", Helvetica, Arial, "Microsoft YaHei", FreeSans, Arimo, "Droid Sans", "wenquanyi micro hei", "Hiragino Sans GB", "Hiragino Sans GB W3", "FontAwesome", sans-serif;} .shouce-icon{color: #fff;} </style> <!--[if IE]> <script src="//cdn.bootcss.com/html5shiv/3.7.3/html5shiv.min.js"></script> <![endif]--> </head> <body> <div id="treeview1"></div> <script> var defaultData = [ { text: 'Parent 1', href: '#parent1', tags: ['4'], nodes: [ { text: 'Child 1', href: '#child1', tags: ['2'], nodes: [ { text: 'Grandchild 1', href: '#grandchild1', tags: ['0'] }, { text: 'Grandchild 2', href: '#grandchild2', tags: ['0'] } ] }, { text: 'Child 2', href: '#child2', tags: ['0'] } ] }, { text: 'Parent 2', href: '#parent2', tags: ['0'] }, ]; $('#treeview1').treeview({ data: defaultData }); </script> </body> </html>
更多Bootstrap相關技術文章,請造訪Bootstrap教學欄位進行學習!
以上是bootstrap有樹狀選單嗎的詳細內容。更多資訊請關注PHP中文網其他相關文章!