Below is a Jquery script that I haven't used before, and don't quite understand:
$(document).ready(function () {
$(".treeview li>ul").css('display', 'none'); // Hide all 2-level ul
$(".Treeviewcollapsible").click(function (e) {
e.preventDefault();
$(this).toggleClass("Treeviewcollapse Treeviewexpand");
$(this).closest('li').children('ul').slideToggle();
});
});
This script controls the expansion and collapse of a tree menu in ASP.net mvc 5.
The script is located in ~/Scripts/Treeview.js and called from the ASP.NET mvc _Layout page.
However, when clicking a link on the tree menu to open a new content page, it collapses the tree menu. Is there a way to keep the tree menu open throughout page clicks?
More information can be found here: