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

  • [Solved] $("#suiteBar").hide(); – Nk SP Mar 31 '14 at 7:45
  • using solution of @Aveenav is more better way – Alexander Ulmaskulov Mar 31 '14 at 16:27
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>
  • elementId change to id of your div or other element. – Alexander Ulmaskulov Mar 31 '14 at 16:19

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.