i am able to hide the #sidenavbox element in SharePoint using the below piece of code:

document.getElementById("sideNavBox").style.display = "block";

but once i hide it, its showing white space in the place where the #sidenavbox div element was present.

enter image description here

Unfortunately i am not able to see a way to hide the white space. Can someone help on the same?


Use This two pieces of code to resolve your problem:

document.getElementById("sideNavBox").style.display = "none";
document.getElementById("contentBox").style.marginLeft = "17px";
| improve this answer | |
  • i am able to do it with a plane style file in script editor web part as:: <style type="text/css"> #sideNavBox {DISPLAY: none} </style>. but as it doesn't suites my need, i go with editing the master pages. Again the above method also doesn't seems to work for me. – SHiBiN Aug 28 '17 at 15:06
  • You didn't specify in your question that you want to apply it in your Master Page. Anyway you can go in yourmasterpage.master and search for a div that containt sideNavBox and add this to it style="display:none" it will be like that <div id="sideNavBox" class="ms-dialogHidden ms-forceWrap ms-noList" style="display:none" > and also search for contentBox div modify it like this <div id="contentBox" aria-live="polite" aria-relevant="all" style="margin-left:17px"> – Youssef Moumen El idrissi Aug 29 '17 at 14:07

Use below code :



document.getElementById("contentareaLeftNavBox").style.display = "none";
| improve this answer | |
  • yeah, tried. But still getting the same error. Also i do see a script <script type="text/javascript">//<![CDATA[ var g_pageLoadAnimationParams = { elementSlideIn : "sideNavBox", elementSlideInPhase2 : "contentBox" }; in the master page. which was there by default i think. Tried removing it, but was getting js error. //]]> </script> – SHiBiN Aug 28 '17 at 14:37

If you using a team site can use this option to hide side bar without code: enter image description here

| improve this answer | |

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.