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
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It only takes a minute to sign up.
Sign up to join this communityYes 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:
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!
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...