Showing posts with label Navigation. Show all posts
Showing posts with label Navigation. Show all posts

Tuesday, June 3, 2014

Quick Launch Accordion with arrow in SharePoint 2013

Modifying the master page

  • On the head tag of master page html add below lines
<!--SPM:<SharePoint:ScriptLink Name="~sitecollection/Style Library/jquery.js" runat="server"/>-->
<!--SPM:<SharePoint:ScriptLink Name="~sitecollection/Style Library/master.js" runat="server"/>-->

  • Add a link to Custom Css in master page.
  • On the head tag of master page html add below highlight lines
<!--SPM:<SharePoint:CssRegistration Name="Themable/corev15.css" runat="server"/>-->

<!--SPM:<SharePoint:CssRegistration Name="https://portal.sharepoint.com/Style Library/Master.css" runat="server" After="corev15.css" />-->

  • In your Custom master.css file, add the below CSS classes
.imgAlign
 {
 padding-right:5px;
 padding-top:5px;
 padding-bottom:3px;

 }

Modify the javascript file

  • On the master.js file add the below code.

jQuery(function($){  
  jQuery('.ms-core-listMenu-verticalBox ul.root > li > a').each(function ()  
  {  
     jChildren = jQuery(this).next('ul');  
     if(jChildren.length!=0)  
     {  
        $(this).find("span.menu-item-text").prepend("<img src='/Style Library/PMO/plusArrow.png' border='0' class='imgAlign' />");  
     }  
  });  
  var jChildrens = jQuery('.ms-core-listMenu-verticalBox ul.root ul');  
   //Expand Active Parent node  
   var selectedIndex = -1;  
   for(var i=0; i < jChildrens.length; i++) {  
     jChidlren = jQuery(jChildrens[i]);  
     if(jChidlren.find('li.selected').length > 0) {  
       selectedIndex = i;  
       break;  
     }  
   }  
   jChildrens.hide();  
   if(selectedIndex!=-1)  
   {  
    jChildrens.eq(selectedIndex).parent("li").find("img.imgAlign").attr("src","/Style Library/PMO/minusArrow.png");  
    jChildrens.eq(selectedIndex).slideDown();  
   }  
   //Parents  
   jQuery('.ms-core-listMenu-verticalBox ul.root > li > a').click(function (e) {  
     jChildren = jQuery(this).next('ul');  
     if(jChildren.length!=0)  
     {  
      e.preventDefault();  
      $(this).find("img.imgAlign").attr("src","/Style Library/PMO/plusArrow.png");  
      jChildrens.slideUp();  
      if (jChildren.is(':visible') == false)  
      {  
      $(this).find("img.imgAlign").attr("src","/Style Library/PMO/minusArrow.png");  
        jChildren.slideDown();  
      }  
     }  
   });  
 });  

Arrow Images



Expanded




Collapsed:


















Wednesday, May 21, 2014

Quick Launch Accordion in SharePoint 2013

Modifying the master page

  • On the head tag of master page html add below lines
<!--SPM:<SharePoint:ScriptLink Name="~sitecollection/Style Library/jquery.js" runat="server"/>-->
<!--SPM:<SharePoint:ScriptLink Name="~sitecollection/Style Library/master.js" runat="server"/>-->

Modify the javascript file

  • On the master.js file add the below code.

 jQuery(function($) {  
 var jChildrens = jQuery('.ms-core-listMenu-verticalBox ul.root ul');  
   //Expand Active Parent node  
   var selectedIndex = -1;  
   for(var i=0; i < jChildrens.length; i++) {  
     jChidlren = jQuery(jChildrens[i]);  
     if(jChidlren.find('li.selected').length > 0) {  
       selectedIndex = i;  
       break;  
     }  
   }  
   jChildrens.hide();  
   if(selectedIndex!=-1)  
   {  
    jChildrens.eq(selectedIndex).slideDown();  
   }  
   //Parents  
   jQuery('.ms-core-listMenu-verticalBox ul.root > li > a').click(function (e) {  
     jChildren = jQuery(this).next('ul');  
     if(jChildren.length!=0)  
     {  
      e.preventDefault();  
      jChildrens.slideUp();  
      if (jChildren.is(':visible') == false)  
      {  
        jChildren.slideDown();  
      }  
     }  
   });
   //Parent Click
   jQuery('.ms-core-listMenu-verticalBox ul.root > li > a > span').click(function (e) {  
     var url = jQuery(this).parent('a').attr("href");  
  window.location=url;
   });    
 });  



Collapsed:

Collapse


Expand:

Expand


Friday, May 2, 2014

Quick launch (Left navigation) styles in SharePoint 2013

Modify the master page

  • Add a link to Custom Css in master page.
  • On the head tag of master page html add below highlight lines
<!--SPM:<SharePoint:CssRegistration Name="Themable/corev15.css" runat="server"/>-->

<!--SPM:<SharePoint:CssRegistration Name="https://portal.sharepoint.com/Style Library/Master.css" runat="server" After="corev15.css" />-->

  • In your Custom master.css file, add the below CSS classes

 .ms-core-listMenu-verticalBox UL.root > LI > .menu-item{  
  font-weight:bold;  
  background-color:#5482AB;  
  color:#ffffff;  
  border-bottom-color:#ffffff;  
  border-bottom-style:solid;  
  border-bottom-width:1px;  
  min-height:25px;  
  padding-top:5px;  
  padding-left:10px;  
  font-size:12px;  
  font-family:Arial, Helvetica, Sans-Serif !important;  
 }  
 .ms-core-listMenu-verticalBox > ul.root > li.static > ul.static > li.static > a:hover {  
   color: #ffffff !important;  
   background-color:#D95E00 !important;  
   text-decoration:none;  
 }  
 .ms-core-listMenu-verticalBox > ul.root > li.selected > a {  
    background-image:none;  
    background-color:#D95E00;  
   color:#ffffff !important;  
 }  
 .ms-core-listMenu-verticalBox > ul.root > li > a:hover {  
    background-image:none;  
    background-color:#D95E00;  
   color:#ffffff !important;  
   text-decoration:underline;  
 }  
 .ms-core-listMenu-verticalBox > ul.root > li.static > ul.static > li > a {  
  font-size:12px;  
  padding-left:10px;  
  font-family:Arial, Helvetica, Sans-Serif !important;  
 }  
 .ms-core-listMenu-verticalBox > ul.root > li.static > ul.static > li > a.selected {  
   background:none;  
    color: #D95E00 !important;  
   background-color:#ffffff !important;  
    text-decoration: none;  
    border: 1px #fff solid;  
    font-weight:bold;  
 }  
 .ms-core-listMenu-verticalBox a.selected  
 {  
  border: 1px #fff solid !important;  
 }  
 .ms-core-listMenu-verticalBox UL.root UL  
 {  
  margin:0px 0px 10px 0px !important;  
 }  

Top Navigation Styles in SharePoint 2013

    Modify the master page

    • Add a link to Custom Css in master page.
    • On the head tag of master page html add below highlight lines
    <!--SPM:<SharePoint:CssRegistration Name="Themable/corev15.css" runat="server"/>-->

    <!--SPM:<SharePoint:CssRegistration Name="https://portal.sharepoint.com/Style Library/Master.css" runat="server" After="corev15.css" />-->


    • In your Custom master.css file, add the below CSS classes

     .ms-breadcrumb-top {  
      background-color:#5482AB;  
     }  
     .ms-core-listMenu-horizontalBox {  
     background-color:#5482AB;  
       padding: 0px;  
       margin: 0px;  
       padding-left: 10px;  
       color: #ffffff;  
     }  
     .ms-core-listMenu-horizontalBox li.static {  
      color: #ffffff;  
     }  
     .ms-core-listMenu-horizontalBox li.static a:hover{  
      color: #ffffff !important;  
     }  
     .ms-core-listMenu-horizontalBox li.static > .ms-core-listMenu-item {  
       color: #ffffff;  
        white-space: nowrap;  
        border: 1px solid transparent;  
        padding: 6px 10px;  
        line-height: 20px;  
        height: 20px;  
        font-size: 10pt;  
        font-weight:bold;  
        font-family:Arial, Helvetica, Sans-Serif;  
        margin-right:5px;  
     }  
     .ms-core-listMenu-horizontalBox li.static span.static {  
     }  
     .ms-core-listMenu-horizontalBox li.static > .ms-core-listMenu-item:hover {  
       text-decoration: none;  
        background-color:#D95E00;  
        background-image:none;  
     }  
     .ms-core-listMenu-horizontalBox li.selected a.selected {  
       text-decoration: none;  
        background-color:#D95E00;  
        background-image:none;  
     }  
     ul.dynamic {  
      background-color:#f7f7f7;   
      border:1px solid #b8babd;  
      padding:0px;  
     }  
     ul.dynamic .ms-core-listMenu-item {  
      background-color:#f7f7f7;  
      line-height:20px;  
      font-size: 9pt;   
      font-weight:normal;   
      color:#333;  
      font-family:Arial, Helvetica, Sans-Serif !important;  
      padding:5px;  
     }  
     ul.dynamic .ms-core-listMenu-item:hover {  
        color:#ffffff;  
        background-color:#D95E00;  
     }  
     .ms-listMenu-editLink  
     {  
       display:none !important;  
     }  
    





    • ms-listMenu-editLink  class is for edit Links button.