Sunday, 8 September 2013

SharePoint 2013: Hiding custom masterpage images in the upload page

My current masterpage contains some custom images and a banner.

<div id="wrapper">
    <div id="logo">
          <a href="/"><img src="/Style%20Library/Images/MyLogo.jpg" alt="My Logo" /></a>
</div>
<div id="banner" />

and a little css around it

#banner{
background-image:url(/Style%20Library/Images/MyBanner.jpg);
background-repeat:no-repeat;
}

This makes the site look great until I try and upload a file to a document library - the banner is now appearing in the upload page.

One way to get rid of it is to use a little JQuery to remove the images.

$(document).ready(function () {
                var pathname = window.location.pathname.toLowerCase();  
             
                    if(( pathname.indexOf('_layouts/15/upload.aspx') >0 )
                  || (pathname.indexOf('_layouts/15/checkin.aspx') >0 ))
               {
                    $("div[Id='logo']").css('display','none');
                    $("div[Id='banner']").css('display','none');
               }
});

No comments:

Post a comment