4

I am deploying a SharePoint2013 App (SharePoint hosted). How can I remove the SharePoint2013 top bar (site name, NewsFeed,OneDrive Sites) by JavaScript/CSS? I need to print tha page.

Thanks,Nk

2
  • [Solved] $("#suiteBar").hide();
    – Nk SP
    Mar 31, 2014 at 7:45
  • using solution of @Aveenav is more better way Mar 31, 2014 at 16:27

2 Answers 2

4

To hide it during Print, you can use the following CSS:

@media print
{    
    div#suiteBar {
        display: none;
    }
}
0

Or you can print only needed element by using this JavaScript code:

<script type="text/javascript"> 
       function printPartOfPage(elementId) { 
        var printContent = document.getElementById(elementId); 
        var windowUrl = ''; 
        var uniqueName = new Date(); 
        var windowName = 'Print' ; 
        var printWindow = window.open(windowUrl, windowName, 'left=-20,top=-20,width=0,height=0'); 
        printWindow.document.write('<HTML><Head><Title></Title>'); 
        printWindow.document.write('</Head><Body style="margin-left:50px;margin-top:50px;font-size:10pt;">'); 
        printWindow.document.write(printContent.innerHTML); 
        printWindow.document.write('</Body></HTML>'); 
        printWindow.document.close(); 
        printWindow.focus(); 
        printWindow.print(); 
        printWindow.close(); 
    } 

</script>
1
  • elementId change to id of your div or other element. Mar 31, 2014 at 16:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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