title: Nested bootstrap 3.1.1 collapse
body: <p>Hi i wonder if someone can help. I'm using Bootstrap 3.1.1 and using nested collapse menus for a sidenav. I want to add a background colour (using a class) to the open menu and remove the background colour on the menu close.</p>
  
  <p>This is working fine, however when i have nested menus the code i'm using removes the background colour for the parent item when closing the child menu and i can't work out how to only remove the background colour if its a top level menu close. So if its a child menu this should not remove the background colour when closing the child menu.</p>
  
  <pre><code>$(".nav-sidenav &gt; li").on("show.bs.collapse", function () {
      $(this).addClass("sidenav-active-background");
  });
  $(".nav-sidenav &gt; li").on("hide.bs.collapse", function () {
      $(this).removeClass("sidenav-active-background");
  });
  </code></pre>
  
  <p>Please see <a href="http://jsfiddle.net/TF2Tg/" rel="nofollow">JSFiddle</a></p>