Customize the Quick Launch as Expand/Collapse in SharePoint 2013/2016 Using Code
var quickLaunchLinks = $("div[id$='QuickLaunchMenu'] > ul > li:has('ul') > a");
quickLaunchLinks.prepend("<span class='ms-commentexpand-iconouter ql-icon'>
<img alt='expand' src='/Comm/Comms2/_themes/1/spcommon-B35BB0A9.themedpng?ctag=2' class='ms-commentexpand-icon'></span>");
quickLaunchLinks.closest("li").find("> ul").hide();
quickLaunchLinks.click(function(e) {
e.preventDefault();
var childUl = $(this).closest("li").find("> ul");
var visibleChildUL = childUl.is(":visible")
if (visibleChildUL) {
$(this).find(".ql-icon").replaceWith("<span class='ms-commentexpand-iconouter ql-icon'>
<img alt='Expand' src='/Comm/Comms2/_themes/1/spcommon-B35BB0A9.themedpng?ctag=2' class='ms-commentexpand-icon'></span>");
childUl.slideUp();
} else {
$(this).find(".ql-icon").replaceWith("<span class='ms-commentcollapse-iconouter ql-icon'>
<img alt='Collapse' src='/Comm/Comms2/_themes/1/spcommon-B35BB0A9.themedpng?ctag=2' class='ms-commentcollapse-icon'></span>");
childUl.slideDown();
}
});
No comments:
Post a Comment