Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Is there a way to add quick launch to a webpart page using Jquery/javascript in SharePoint 2010?

Note : I don't have access to SharePoint Designer

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

Yes you can! (depending on your site type). This is true for Team and Publishing sites. It will probably work on other site types as well, but not tested.

If you inspect your page, you will notice that the left navigation (#s4-leftpanel) is hidden when using some page layouts,specifically the Splash page layout (under Welcome page layouts). On others like the Blank Web Part Page, also under Welcome page layouts, the left nav is visible.

To ensure this will work, view your page in a browser and do a View Source. Search for #s4-leftpanel, and verify that your left nav is getting rendered on the page.

You need to do 2 things to get the left navigation to show:

  1. Make the left navigation visible
  2. Add margin to the main body to make the left nav visible (it has a white background and without left-margin, will float over the left nav)

Add this to your stylesheet and you should be good:

#s4-leftpanel {
    display: block !important;
}
#MSO_ContentTable {
    margin-left: 155px !important;
}

And this is how you do it in jQuery: (I'm using the .attr() tag instead of .css() because of the !important declaration.) Keep in mind that with jQuery, users will see the left nav pop in on page-load (since it doesn't run until the page is rendered).

jQuery(document).ready(function() {
    jQuery('#s4-leftpanel').attr('style','display: block !important');
    jQuery('#MSO_ContentTable').attr('style','margin-left: 155px !important');
});

Hope this helps!

share|improve this answer
    
i have applied above jquery to SP 2010 blank webpart page. After applying it shows only blank left border of quick launch rather than original quick launch of SP 2010. Do we need to make any changes before we apply this jquery? Thanks. –  user9929 Aug 7 '12 at 14:55
add comment

Can I ask why you don't have access to SP Designer? If you aren't a web administrator or the Site administrator, why wouldn't you collaborate with him/her?

Also, instead of Jquery you can just attach the v4 masterpage to allow the quick launch to show, and also editing the file in advanced mode to add the quick launch will also work...

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.