Hide the quick launch on a SharePoint page – Part 1

After you created a new SharePoint site, probably you have a lot of stuff to do with it. You need to customize it and fill with contents. One of the customizing tasks is usually the hiding of the quick launch. In this post I will show you different methods how you can implement this in SharePoint 2007.

First of all, let’s see the default view of a just created site:

As you can see the quick launch is in the left side of the page. Let’s look at the first possibility:

1. Disable quick launch from the site settings menu

In the right upper corner you can find the “Site Actions” button. Click on it, and choose the “Site Settings” option. The settings site appears. In the “Look and Feel” column click on the “Tree view” link.

Untick the checkbox, than click to the “OK” button. Now let’s see what happened on the default page.

The quick launch is disappeared, but the “View All Site Content” option is visible even with read permission. Unfortunately we need to admit that solution is not the best for hiding the quick launch.

2. Disable quick launch with jQuery

First of all you need a jQuery library. You can downloaded it form jquery.com. Upload it to a document library on your site. You can use the default library (Shared Documents) or create a new one. I did that, I’ve created a library named “sitecontentfiles”. The next step is to add a new web part to your page. So click again on the “Site Actions” button and choose the “Edit Page” option. Click on the “Add a Web Part” button, and import a “Content Editor Web Part”.

When you successfully added the CEWP, open the tool pane, and click on “Source Editor”. A new window will appear where you can edit the jQuery code. First of all you need to import the library. I did it with relative path as you can see in the code below.

<script language="javascript" type="text/javascript"
src="./sitecontentfiles/jquery-1.6.4.min.js"></script>

<script language="javascript" type="text/javascript">

</script>

Next step is to check the quick launch id or class. For this task I always use a Firefox add-on. It’s the Firebug. If it is missing, you need to install it. Open a Firefox browser and in the Add-ons menu you can easily install it. After this open your site in the browser click on the Firebug icon in the upper right corner of the page. Pick the icon which has a red circle in the picture and click on the quick launch. Now you can see the div class of the chosen element. In my case it is the “<div class=”ms-quicklaunchouter”>”.

We have already known the div class of the element, so nothing else left, just hide it by the class.

 
<script language="javascript" type="text/javascript"
src="./sitecontentfiles/jquery-1.6.4.min.js"></script>

<script language="javascript" type="text/javascript">

$(document).ready(function() {

$(".ms-quicklaunchouter").hide();

});

</script>

And now let’s see, how the page looks like:

It looks better than in the first case, but unfortunately a blank zone remain on the left side. In the third section I will tell you why.

3. Disable quick launch with CSS

The last possibility what I want to show you in this post is the hiding with the help of CSS (Cascading Style Sheets). Go back a little bit to the Firebug. Open the site again, and as we did it before, pick the quick launch again. After this in the html code section select the class one level up (class=”ms-navframe”).

And now you can see that the whole left side is selected. Add a CEWP again and use the following code:

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

Save it, and now your page should look like this:

Now the blank zone from the left side is disappeared. Of course if we hid the ms-navframe class in the jquery code, we got the same result. I just wanted to show how important to choose the right class from the html code.

In the part 2 I show you, how to do that via SharePoint Designer.

Advertisements

1 thought on “Hide the quick launch on a SharePoint page – Part 1”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s