Thursday, August 6, 2009

Hide or Show Quick Launch Bar

Title: Hide or Show the Quick Launch Bar

Scenario: Our custom master page (xyz.master) overrides the default.master page. The requirement was not to show the left navigation / quick launch menu on the left hand side. However, some site collections that inherit our xyz.master might need the feature of having quick launch visible.

Preface: There are many ways to do it. You can write code that behave intelligently to handle this and so on and so forth. But the situation could be - it is already hosted and may not have room for a binary drop or feature stapling. Well what I did?

At first place, the quick launch menu can be hidden using the below CSS code

Code:

<style>
.ms-navframe { display:none; }
</style>

So to enable it back, all we need to do is to set the display property to 'block' instead.

I added a content editor webpart and add the below code to the page.

<style>
.ms-navframe { display:block; }
</style>

Since a CEWP can handle code that of script and styles, it can override the master page css and displays the quick launch.

No comments: