jQuery.TreeView外掛程式實現樹狀導航(十三)

來源:互聯網
上載者:User

標籤:

一:jQuery.TreeView外掛程式簡介

該外掛程式的特點:

1、支援靜態樹,即一次性將全部資料載入到用戶端。

2、支援非同步樹,即一次只載入一級或若干級節點,子節點可以非同步載入資料。

3、支援節點級聯。

4、能夠承載大資料量,並效能表現優異。

5、支援主流瀏覽器。

6、使用方便
官方網站:
http://bassistance.de/jquery-plugins/jquery-plugin-treeview/

二:jQuery.TreeView外掛程式使用

Step 1:添加相關css及js的引用  <link rel="stylesheet" href="../jquery.treeview.css" />

 

  <script src="../lib/jquery.js" type="text/javascript"></script>  <script src="../lib/jquery.cookie.js" type="text/javascript"></script>  <script src="../jquery.treeview.js" type="text/javascript"></script> Simple:
分頁檔.html
<ul id="navigation">        <li><a href="#aaa">Item 1</a>            <ul>                <li><a href="?1.0">Item 1.0</a>                    <ul>                        <li><a href="?1.0.0">Item 1.0.0</a></li>                    </ul>                </li>                <li><a href="?1.1">Item 1.1</a></li>            </ul>        </li></ul>

JS代碼

<script type="text/javascript">        $(document).ready(function() {                $("#navigation").treeview({                    persist: "cookie",                    collapsed: true,                    unique: true                });         });</script>

效果:

二:treeview的一些屬性

Options說明:
1、animated
設定動畫效果.
Eg:$(".selector").treeview({ animated: "fast" })
2、collapsed
Treeview節點是否收縮,true:收縮,false:展開
$(".selector").treeview({ collapsed: true })
3、control
TreeView顯示的容器
$(".selector").treeview({ control: “#container” })

4、unique
設定是否某一時刻只展開一個節點,
true:只展開一個,false:可以同時展開其他節點。
$(".selector").treeview({ unique: true })
5、toggle
$(".selector").treeview({ toggle: function() { console.log(this + " has been toggled"); } })

6、persist

$(".selector").treeview({ persist: "location" })

 

8、add
   var tree = $(".selector").treeview(); $(".button").click(function() { var newSublist = $("<li><span class=‘folder‘>New Sublist</span><ul>" + "<li><span class=‘file‘>Item1</span></li>" + "<li><span class=‘file‘>Item2</span></li></ul></li>").appendTo(tree); tree.treeview({ add: newSublist }); });

 

 

 

jQuery.TreeView外掛程式實現樹狀導航(十三)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.