-->

Monday 25 June 2012

Sharepoint Branding And Customizations - Part 2

In my previous article Sharepoint Branding And Customizations - Part 1, we went through how to change the logo and customize our Top Navigation Menu, Viz our step1 and step 2 of our tutorial.


In this article we will proceed with our next two steps

  • Customize your Quick Launch on Left Navigation Bar
  • Add Social Icons
3. Customize your Quick Launch on Left Navigation Bar

As we modified the styles for the top Navigation bar we will add the style for the left navigation as well. But in addition to that we will add accordion to the Left Navigation Bar using JQuery. First lets start with our styling.

Copy the following code-snippet under the <Head> tag of your V4.master page. Avoid merging this style tag with the previous style tag of our Top Navigation Bar, to make the code more readable for future reference

<style type="text/css">
        /* --------- Quicklaunch ----------- */
        .ms-quickLaunch
        {
            padding-top: 0px;
        }
        #s4-leftpanel-content
        {
            background-color: transparent !important;
        }
        #s4-leftpanel-content
        {
            border: 0px !important;
            background-color: transparent !important;
        }
        .s4-ql
        {
            background-color: #fff;
            margin-bottom: 0px !important;
        }
        /* Inner nav element */
        .menu-vertical
        {
            padding: 0px !important;
        }
        /* top rounded */
        #QLtopwrapper
        {
            background: url('/Style%20Library/Images/QLtop.png') repeat-x;
            height: 19px;
            width: 220px;
        }
        /* bottom rounded */
        #QLbottomwrapper
        {
            background: url('/Style%20Library/Images/QLbottom.png') repeat-x;
            height: 19px;
            width: 220px;
        }
        .menu-vertical > ul.root > li.static > .menu-item
        {
            border-bottom: 1px #929292 solid !important;
            padding-left: 0px;
            color: #fff;
            font-family: Arial;
            font-size: 11px;
            font-weight: bold;
            background-color: #00557B !important;
            background-color: #00557B !important;
        }
        .menu-vertical > ul.root > li :hover
        {
            color: #000000;
            background: -webkit-gradient(linear, left top, left bottom, from(#0087C1), to(#ffffff));
            background: -moz-linear-gradient(top, #0087C1, #ffffff);
        }       
        /* Selected */
        .s4-ql a.selected
        {
            background-color: transparent;
            background-image: none;
            border: 1px transparent solid !important;
            color: #fff !important;
        }
        /* no border in teamsites */
        .s4-ql, .s4-specialNavLinkList
        {
            border: 0px !important;
        }
        .menu-vertical > ul.root > li.static
        {
            padding: 0px !important;
            margin: 0px !important;
        }
        /* headers */
        .menu-vertical > ul.root > li.static > a.menu-item
        {
            padding: 10px 4px 10px 5px;
            border-bottom: 1px #ccc solid;
        }
        /* headers selected for publishing sites */
        .menu-vertical > ul.root > li.static > a.selected
        {
            padding: 10px 4px 10px 3px;
            padding-left: 4px !important;
            background-color: #777 !important;
        }
        /* Subitem container */
        .menu-vertical > ul.root > li.static > ul
        {
            margin-bottom: 0px;
            padding-top: 0px;
            padding-bottom: 0px;
        }
        /* SubItems wrap */
        .menu-vertical > ul.root > li.static > ul.static > li.static > a
        {
            font-family: Arial, Helvetica, sans-serif;
            font-size: 11px;
            padding: 10px 4px 10px 8px;
            color: #ccc !important;
        }
        /* SubItems  */
        .menu-vertical > ul.root > li.static > ul.static > li.static > a > span > span
        {
            color: #333;
            text-decoration: none !important;
        }
        /* SubItems hover */
        .menu-vertical > ul.root > li.static > ul.static > li.static a:hover
        {
            text-decoration: none !important;
            background-color: #0087C1; /* fallback */
            color: #000;
        }
        /* Selected SubItems  */
        .menu-vertical > ul.root > li.static > ul.static > li.selected > a.selected
        {
            background-color: #fff;
            border: 1px transparent solid !important;
            padding-left: 10px !important;
        }
        /* Selected SubItems  */
        .menu-vertical > ul.root > li.static > ul.static > li.selected > a.selected > span > span
        {
            color: #000;
        }
        .menu-vertical > ul.root > li.static > ul.static > li
        {
            border-bottom: 1px #8C8C8C solid !important;
        }
    </style>

This will add the styling to your left navigation bar with the hover effect, But still we need to add accordion style to it.

Copy the following code-snippet to your <Head> tag of V4.master page
<script type="text/javascript" src="../../Style Library/jsapi.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $("div.menu-vertical>ul.root>li.static>a").toggle(
            function () {
                $(">ul", $(this).parent()).show("fast");
            },
            function () {
                $(">ul", $(this).parent()).hide("fast");
            }
            );
            $("div.menu-vertical>ul.root>li.static>ul.static").css("display", "none");
            var s = $("div.menu-vertical>ul.root>li.static>ul.static>li.selected").parent();
            var p = s.parent();
            p.find('ul').css("display", "");
        });
    </script>




If you look through the above code-snippet you will find that we have made reference to jsapi.js file. You can find this jsapi.js file over here. Download this file and upload it to the Style Library Folder and you are good to go. (You can upload it to different location also but do not forget to update the location in this code-snippet)

Check-In the Master page, And your Left Navigation Quick Launch is ready with the Accordion Effect !

4. Add Social Icons

Now a days Everyone is going social, so its necessary to market your brand on the social networking sites like Facebook, Twitter, Linked-In and so on. This way has been proved very useful to market your business/site.

You can get the icons used in this example from here. Upload the icons into the Style Library/Images folder of your site.

Now again we will be playing with the CSS again.

Copy the below code-snippet and paste it in the <Head> tag of your V4.master page
<style>
        #social
        {
            margin-bottom: 0px;
            position: relative;
            float: right;
            width: 300px;
            margin-right: 10px;
            height: 50px;
        }
        #social UL
        {
            padding-bottom: 0px;
            list-style-type: none;
            margin: 0px;
            padding-left: 0px;
            padding-right: 0px;
            list-style-image: none;
            padding-top: 0px;
        }
        #social LI
        {
            float: left;
            margin-left: 2px;
            display: inline;
        }
        #social A
        {
            text-indent: -99999px;
            width: 55px;
            display: block;
            height: 55px;
        }
        #social-fl A
        {
            background-position: 0px 0px;
        }
        #social-fb A
        {
            background-position: -88px 0px;
        }
        #social-tw A
        {
            background-position: -95px 0px;
        }
        #social-rss A
        {
            background-position: -143px 0px;
        }
        #social
        {
            margin-top: 0px;
            float: right;
        }
        #social UL
        {
            padding-bottom: 0px;
            list-style-type: none;
            margin: 0px;
            padding-left: 0px;
            padding-right: 0px;
            list-style-image: none;
            padding-top: 0px;
        }
        #social LI
        {
            float: left;
            margin-left: 2px;
            margin-right: 10px;
        }
        #social LI A
        {
            text-indent: -99999px;
            width: 48px;
            display: block;
            background-repeat: no-repeat;
            height: 48px;
        }
        #social-tw
        {
            background-image: url('/Style%20Library/Images/twitter4_512.png');
        }
        #social-li
        {
            background-image: url('/Style%20Library/Images/linked_in.png');
        }
        #social-fb
        {
            background-image: url('/Style%20Library/Images/facebook.png');
        }
        #social-rss
        {
            background-image: url('/Style%20Library/Images/google_plus.png');
        }
        #social-blog
        {
            background-image: url('/Style%20Library/Images/blog.png');
        }
    </style>



At this point we have just prepared the style, now we acctually need to add it in our Body of our V4.master page.

Locate the <td class="s4-socialdata-notif"> tag in your master page and add the below EXACT code-snippet ABOVE this tag.

<td>
        <div id="social">
            <ul>
                <li id="social-tw"><a title="Follow us on Twitter" href="https://twitter.com/BeingDhavalShah">
                    Twitter</a></li>
                <li id="social-li"><a title="Link up with us on Linked In" href="http://in.linkedin.com/pub/dhaval-shah/22/8b0/280">
                    LinkedIn</a></li>
                <li id="social-fb"><a title="Friend us on Facebook" href="https://www.facebook.com/dhaval.shah01">
                    Facebook</a></li>
                <li id="social-rss"><a title="Connect on Google Plus" href="https://plus.google.com/114652325732564196178/posts?hl=en">
                    Google Plus</a></li>
                <li id="social-blog"><a title="Dhaval Shah's Blog" href="http://kalashnikovtechnoblogs.blogspot.com">
                    Blog</a></li>
            </ul>
        </div>
    </td>


Save/Check In your master page, and you can see the Social Networking icons located right above the Top Navigation Bar !
You can customize it to add/remove the icons according to your choice.

My next article will be end of this tutorial(Hopefully) !

Stay tuned ! Happy SharePointing !

Please do Share/Like/Comment if this article helped you, author really appreciates.

Sharepoint Branding And Customizations - Part 1

Last week I took part in the EUSP Hunger Games Challenge organized by EndUserSharepoint community. Where we were to perform some tasks and submit our sharepoint site back to them.


The major part which I concentrated on was SharePoint Branding, I wanted my SharePoint site to look more stylish than our typical SharePoint Site. Here are the Screen-shots of what I achieved in almost one day work !
You can view the site over here, But I am not sure how long this week will be active as I was using trial version of CloudShare.

I will divide the branding part into 6 steps :
  1. Get a Logo for your site
  2. Customize your Top Navigation Bar
  3. Customize your Quick Launch on Left Navigation Bar
  4. Add Social Icons
  5. Add Copyright Footer
  6. Customize your page to add twitter,FAcebook and Youtube to your page
Lets start with the 1st Step

1. Get a Logo for your site

Its necessary to have your own logo for your site, Get it designed and follow the below steps to upload it.

I designed the logo for myself ! Sharepoint Geek - Dhaval Shah :)

Al right, now you have to do is to open your V4.master page using SharePoint Designer. Search for the tag "s4-titlelogo" and replace the default logo url in the <Sharepoint:SiteLogoImage> tag with your uploaded logo.

<td class="s4-titlelogo">
      <SharePoint:SPLinkButton runat="server" NavigateUrl="~site/" id="onetidProjectPropertyTitleGraphic">
     <SharePoint:SiteLogoImage name="onetidHeadbnnr0" id="onetidHeadbnnr2" LogoImageUrl="/_layouts/images/SPGeek.png" runat="server"/>
     </SharePoint:SPLinkButton>
</td>

So Step1 was not that tough, Lets move to next step.

2. Customize your Top Navigation Bar

For this we have to play around with the CSS a little bit. By Default, V4.master page uses the core.css file for styling. we won't be changing that but we will over-ride the styles from core.css file in our master page, So it's good to have little bit idea about the the styles used in core.css. I suggest you to go through the stylesheet. If you are lazy like me, don't worry you can directly copy-paste the styles specified below in your master page.

    <style>
        /* Navigation list */
        .s4-tn
        {
            background-color: #00557B;
            padding: 0px;
            margin: 0px;
        }
        /* Global navigation */
        .s4-tn li.static > .menu-item
        {
            color: #fff;
            white-space: nowrap;
            border: 1px solid transparent;
            padding: 4px 10px;
            line-height: 25px;
            height: 28px;
        }
        /* Hover */
        .s4-tn li.static > a:hover
        {
            background: url("/_layouts/Images/selbg.png") repeat-x left top;
            background-color: #0087C1;
            color: #000;
            text-decoration: none;
        }
        /* Selected */
        .s4-toplinks .s4-tn a.selected
        {
            background: url("/_layouts/Images/selbg.png") repeat-x left top;
            background-color: #0087C1;
            color: #fff;
            text-decoration: none;
            border: 1px transparent solid;
            padding-right: 10px;
            padding-left: 10px;
            margin: 0px;
        }
        /* Position for search */
        .s4-search
        {
            padding-top: 7px !important;
        }
        /* Remove dotted outlines */
        a:hover, a:active, a:focus
        {
            outline: none;
        }
       
        /* No arrows applies two levels */
        .menu-horizontal a.dynamic-children span.additional-background, .menu-horizontal ul.dynamic a.dynamic-children span.additional-background
        {
            background-image: none;
        }
        .s4-tn ul.dynamic
        {
            /* UL wrap */
            background-image: none;
            border-top: 0px #ccc solid;
            border-right: 1px transparent solid;
            border-bottom: 1px #ccc solid;
            border-left: 1px #ccc solid;
            margin: 0px;
            padding: 0px;
        }
        /* LIs */
        .s4-tn li.dynamic
        {
            background-image: none;
            border-top: 1px #ccc solid;
            border-right: 1px #ccc solid;
            border-bottom: 1px #fff solid;
            border-left: 1px #fff solid;
        }
        /* LI menu items */
        .s4-tn li.dynamic > .menu-item
        {
            padding: 7px 10px;
            height: 16px;
            color: #333;
            background-color: #f7f7f7; /* fallback */
            background: -webkit-gradient(linear, left top, left bottom, from(#ffffff), to(#f7f7f7));
            background: -moz-linear-gradient(top, #ffffff, #f7f7f7);
            filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#ffffff, endColorstr=#f7f7f7);
            -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#ffffff, endColorstr=#f7f7f7)";
        }
        /* LI menu items hover */
        .s4-tn li.dynamic > a:hover
        {
            color: #00557B;
            background-color: #fff; /* fallback */
            background: -webkit-gradient(linear, left top, left bottom, from(#ffffff), to(#ffffff));
            background: -moz-linear-gradient(top, #ffffff, #ffffff);
            filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#ffffff, endColorstr=#ffffff);
            -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#ffffff, endColorstr=#ffffff)";
        }
    </style>



Just paste the above code-snippet in the <Head> tag of your V4.master page.
And style of your Top Navigation bar would be updated. Not so much to do, Isn't it ?

In my next article I will explain the other steps.

Stay tuned ! Happy SharePointing !

Please do Share/Like/Comment if this article helped you, author really appreciates.