Question

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

Was it helpful?

Solution

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

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

OTHER TIPS

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>
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top