[BUG] When injecting sidebar into my pages, collapsible menu items stop working
Im not sure this is a bug, and perhaps im doing something incorrectly but hopefully someone will point me in the right direction.
I am quite new to this, but it seems insane that I would duplicate the sidebar and navbar on every single page, so instead I have created a div like so, in the body:
<div id="common-sidebar"></div>
And then, in my page I have
window.onload = function () {
// The sidebar
$.get("sidebar.html", function (data) {
$("#common-sidebar").html(data);
});
}
and, I get a common sidebar in the page. The links work etc, but if I try to collapse or expand the menu items nothing happens, like the click is ignored or not attached.
What am I doing wrong? What is the right way to do this?
You need to init the pushmenu & treeview plugin otherwise the sidebar will not collapse or the menu items will not open/close.
You need to init the pushmenu & treeview plugin otherwise the sidebar will not collapse or the menu items will not open/close.
Using angularjs there is a way to init pushmenu and treview?