Sunday, March 12, 2006

Hiding the SharePoint QuickLaunch Bar in 6 Lines of code...

Todd Bleeker’s 60 Hive - Hide the Quick Launch Bar

"Continuing with the Content Editor Web Part (CEWP) series (http://MindsharpBlogs.com/Todd/articles/793.aspx).

When people ask me how to alter various elements of a Web Part Page; one common request is to hide the Quick Launch bar in a Windows SharePoint Services (WSS) Team Site. Fortunately, the code to do this can be readily understood by those with limited CSS and JavaScript experience (Step By Step instructions will be given near the end of this post) so it is a great place to begin discussion about the capabilities of the CEWP.

Import the StyleUnderCursor.dwp CEWP from my previous post onto the Home page of a Team Site and place your mouse over the top of the Quick Launch and you will see that there are three CSS classes consistently used ms-main, ms-nav, and ms-navframe to define the style of the Quick Launch
...
To hide the Quick Launch, download and import my HideQuickLaunch.dwp or paste the following code into the property builder that pops up when the Source Editor... button of your new CEWP is clicked; then click the Save button.
...
Imagine, your end user being able to dray and drop a no-server touch Web Part called Hide Quick Launch Bar from a Web Part Gallery on any Team Site (or custom Site Definition with a Quick Launch Bar equivalent) and the Quick Launch Bar simply disappears. They think you are a genius, but a half-dozen lines of code exported into a CEWP DWP is all it took. [Emphasis added]..."

I was reminded of this cool "Hide the Quick Launch" hack today when reading Todd’s "Guidelines to Centralize SharePoint Style/Script Customizations" post this morning.

What makes this so cool, is that by using the Content Editor WebPart (CEWP) you can tweak the entire web page. I’ve always thought of the CEWP as a "container" part. A place to embed other web pages, flash or to add rich text to my web pages, etc. I’ve never thought of it as a control/script insertion point to tweak the entire page.

This was a "lightbulb over the head" moment. It opens up a whole new area of thought for me...

You don’t need admin access to the site/page, just the ability to add a single webpart (such as like via the "My Page" functionality). No need to touch the server, no need for any tool beyond a web browser, no need to install anything... That’s just cool.

One tip to remember when using this trick, put the CEWP "Hide Quick Launch" webpart at the bottom of the page. Putting it above the other webparts on the page will hide them too (which is bad...  ;)

Technorati Tags: , , ,

1 comment:

Unknown said...

Awsome,
I had finally just given up hassling IT to remove the darn thing for me. And had settled down to just accept it being there and was looking for ways to edit it to meet my goals.

Oh and I love that style under cursor addon too...