1

I would like to add a button to a webpart we have already created that increases usability for our document libraries. I would like this button, when clicked to toggle the standard ribbon that is shown in document libraries. I realize this functionality already exists inherantly in sharepoint but it is not very obvious to our users who aren't regulars.

Ideally I just want something that I can throw in a jquery click funciton. I have tried using some code from other examples out there but no success. Can someone tell me how to trigger the out of the box sharepoint ribbon hide and show events??

1

The following should work from a click event:

$("#s4-ribbonrow").hide().parent().find("#s4-workspace").css({ "height":"auto", "overflow-y":"auto" });

Example:

<a href="javascript:" onclick='$("#s4-ribbonrow").hide().parent().find("#s4-workspace").css({ "height":"auto", "overflow-y":"auto" });'>Full Screen</a>

Paul.

  • I should mention. This will only hide it. Making it visible again is tricky, specially if the user does a browser window resize after the ribbon was closed. My suggestion for bringing the ribbon back is to refresh the page. – Paul T. Nov 20 '13 at 2:03
  • Unfortunately I was more looking for the show ribbon. Currently our ribbon is hidden by default so a refresh wouldn't be very helpful. – BlueBird Nov 21 '13 at 13:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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