Content hidden by Edit Bar

Permalink 2 users found helpful
Hi,

I have a navigation bar which is absolutely positioned at the top of the browser window but unfortunately when I'm logged in the C5 edit bar covers my navigation bar.

I know what I want to do:
Place a bit of php code in the containing div for the navigation bar which if the user is logged in adds a class to this containing div (class="loggedin") for instance, then in the stylesheet I can style this class to move the bar away from the top of the window by the depth of the C5 edit bar.

What I need is the bit of code which will perform this check and add the class definition.

I hope someone can help me resolve this.

Many thanks in advance,
Tony.

 
Mnkras replied on at Permalink Reply
Mnkras
if (isset($cp)) {
   if ($cp->canWrite() || $cp->canAddSubContent() || $cp->canAdminPage() || $cp->canApproveCollection()) {
//editbar is loaded
}
beebs93 replied on at Permalink Best Answer Reply
beebs93
This is how I have my <body> tag on every C5 site I build:
<?php
$u = new User();
?>
<body class="<?php echo $c->getCollectionTypeHandle(); echo $c->isEditMode() ? ' editMode' : ''; echo $u->isLoggedIn() ? ' loggedIn' : ''; ?>">


This way, I can target a certain template, if someone is logged in and/or if the page is in edit mode with simple CSS rules.

If your navigation bar has an id of "nav-bar" then in your main.css file:

#nav-bar{
// normal CSS rules here
}

.loggedIn #nav-bar{
// CSS rules to move the navbar
}
Fluvius replied on at Permalink Reply
Many thanks and sorry for the delay in my reply.
That worked a treat. I'll have to remember that useful bit of code :)

Thanks again,
Tony.
beebs93 replied on at Permalink Reply
beebs93
No problem - glad it worked out :)
rutrem replied on at Permalink Reply
rutrem
hi
i have a similar problem, i just have to modify the way the footer is positioned in edit mode.
i have tryed this code and works for all content ares except for footer and header... does it could work with those elements?