Bootstraps fixed navbar hides admin bar

Permalink 1 user found helpful
Hey guy,
the site I'm building right now makes use of Bootstraps horizontal navbar which is a sticky navigation and fixed top (.navbar-fixed-top). The problem is: it hides my admin navbar so I'm not able to do stuff like pushing the 'Edit' button because it's just not visible.

I found out that something like this might help:

<body <?php if ($c->isEditMode()) { ?> class="editmode" <?php } ?>>

But I didn't get a solution that really worked - any ideas how to solve this?

View Replies: View Best Answer
apc123 replied on at Permalink Best Answer Reply
apc123
Try something like this:

<?php
  $u = new user();
  $g = Group::getByName('Administrators');
  if ($u->inGroup($g)||$u->isSuperUser())  {
         echo '<nav class="navbar navbar-inverse navbar-default" role="navigation">';
      } else {
        echo ' <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">';
        }
        ?>


This will switch out the fixed nav bar for a non fixed one when an Administrator is logged in.

Cheers,
Anthony
mlmedia replied on at Permalink Reply
Hey,
thanks for the answer, sounds like a great idea! Where do I have to place this snippet?!
apc123 replied on at Permalink Reply
apc123
See this section?

echo '<nav class="navbar navbar-inverse navbar-default" role="navigation">';
      } else {
        echo ' <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">';
        }


That echo's out the standard bootstrap code for the navbar. You'd place this where place your navbar code.
mlmedia replied on at Permalink Reply
Absolutely brilliant! Thank you very much! Works great!
mlmedia replied on at Permalink Reply
well, now from one moment to another the dropdown menu stopped working... wtf