All child pages set to hide in menu but sub indicator & empty <ul> still appears

Jan 20, 2012 at 12:22 AM

When a page in DNN has child pages but all of these are set up to be hidden from the menu (Display in Menu is unchecked for all children), the Superfish version of this menu control still renders the <ul> element and the sub indicator on the containing page's link and when hovering over this menu, a popup appears (all that you can see is the sub indicator and the shadow of the empty <ul>).

To hack & slash my way around it, I added this jQuery snippet to my global script:


<script type="text/javascript">

 function removeEmptySubIndicators() {
  $(".sf-with-ul").siblings("ul").each(function() {
     if($(this).children().length == 0) {
       $(this).siblings(".sf-with-ul").find(".sf-sub-indicator").remove();
       $(this).remove();
     }
   });
 }

 $(document).ready(function() {
    window.setTimeout("removeEmptySubIndicators();", 500);
 });

</script>

I had to run this script even a little after the document was ready because the menu tree gets built within the same event.  This is obviously a hack-around, but seems to work for me - in the meantime, I wonder if this issue is with Superfish or with the DNN Menu provider.  Either way, I hope this helps others who run into the same issue.