Thursday 15 May 2014

Branding CSS and Javascript tricks

How To: Hide Left Side Navigation on Home Page
<style type="text/css">
 body #s4-leftpanel {display: none;
.s4-ca {margin-left: 0px;
 </style>

How To: Hide Recently Modified
<style type="text/css">
 .s4-recentchanges {display:none;}
</style>

How To: Change the “No Items” message in a discussion web part with jQuery
<script type="text/javascript">
 $(document).ready(function(){
 $("td .ms-vb:contains('There are no items to show in')").text('There are no active discussions');
  });
</script>

How To: Hiding “Add new item” and “There are no items to show…” in SharePoint
https://www.threewill.com/2013/12/hiding-add-new-item-and-there-are-no-items-to-show-in-sharepoint/

How To: How To Remove Extra Space Around the Web Part In SharePoint 2013
<style type="text/css">
 .ms-webpartPage-root {border-spacing: 0px !important;}
 .ms-webpartzone-cell {margin: 0px !important;}
</style>

How To: Hide a web part with zero rows
<script>
function HideWebPartWithZeroRows()
{
  var a = document.getElementsByTagName("TABLE")
  for (var i=0;i<a.length;i++)
  {
    if (a[i].summary=="Test List")
    {
      if (a[i].rows.length==1)
      {
        //hide all but the title bar
        //var x =  a[i].parentNode.parentNode.parentNode.parentNode.parentNode
        //hide the entire web part
        var x =  a[i].parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode

        x.style.display="none";
      }
    }
  }
}
_spBodyOnLoadFunctionNames.push("HideWebPartWithZeroRows") 
</script>

How To: Remove link border from around image
<style>
   a img {border:none}
</style>
<a href="http://sharepoint.stackexchange.com">
   <img src="http://cdn.sstatic.net/sharepoint/img/logo.png">
</a>

OR via inline styles:


<a href="http://sharepoint.stackexchange.com">
   <img src="http://cdn.sstatic.net/sharepoint/img/logo.png" style="border:none;">

</a>

No comments:

Post a Comment