开发者

jQuery treeview highlight selected

开发者 https://www.devze.com 2022-12-13 02:05 出处:网络
Is highlighting the selected item supported in jQuery treeview?Can you point me at sampl开发者_JAVA技巧e code demonstrating this?yes

Is highlighting the selected item supported in jQuery treeview? Can you point me at sampl开发者_JAVA技巧e code demonstrating this?


yes http://docs.jquery.com/Plugins/Treeview/treeview#options persist


The persist option persists the tree state in cookies or the page location.

If set to "location", looks for the anchor that matches location.href and activates that part of the treeview it. Great for href-based state-saving.

If set to "cookie", saves the state of the tree on each click to a cookie and restores that state on page load.

The following code sample enables the navigation option for this treeview, matching the active treeview element to location.href

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


To visually highlight the selected item, you can add a $('selector').click() method to the base list elements that you build the JQuery Treeview on.

When that list element is clicked, your click function will be fired. You can then, in this function, change the CSS class of the selected element to highlight it.

0

精彩评论

暂无评论...
验证码 换一张
取 消