Skip to main content

Add a responsive dropdown menu To Your Blog on blogger




This responsive dropdown menu will definitely make your blog look stylish and professional, to say the least.
Initially, I had a horizontal menu display which kind of took a good amount of space in my blog's mobile view.
Originally gotten from mybloggerlab, I only made minor tweaks by adding the social bar and search box as well as making it sticky.
Below are the features of this menu
Responsive - this menu is very responsive  and doesn't take much space in your blog. If you use the default blogger template, a switch between desktop and menu view leaves you with the desktop and mobile menu respectively.
Light weight - this menu for the health of your blog is light wight and loads instantly with your blog.
Note; This dropdown menu doesn't have sub-menu thus not suitable for those in search of a menu bar with sub-menu and you may have to continue your search!
All the same, this menu is perfect!
How to add the Responsive dropdown menu with social and search box to blogger...
Before you take more steps, please back up your template, in case you make some unknown mistakes.
Need a Demo? Check it out 

Step 1- Adding the CSS
Search for ]]></b:skin>, then paste the CSS code below just above it.

/*** Dropdown Menu***/
#nav-wrapper {
 margin:0 auto;
 position: fixed;
 width:100%;
 float: none !important;
     top: 0px;
     padding-bottom: 5px;
     z-index: 1;
     height: 20px;
     border-bottom: 1px solid #fafafa;
}
#nav-trigger {
    display: none;
    text-align: left;
}
#nav-trigger span {
    display: block;
    background-color: #000;
    cursor: pointer;
    text-transform: uppercase;
    padding: 0 25px;
    color: #EEE;
    line-height: 50px;
}
nav#nav-mobile {
    margin: 0px;
}
nav {
    margin-bottom: 30px;
}
#nav-main {
 background-color: #000;
    float: left;
    width: 100% !important;
}
#nav-main ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
    text-align: left;
}
#nav-main li {
    display: inline-block;
    float: left;
    ont-family: '
    Open Sans'
    , sans-serif;
}
#nav-main li:last-child {
    border-right: none;
}
#nav-main a {
    padding: 0 25px;
    color: #EEE;
    line-height: 67px;
    display: block;
}
#nav-main a:hover {
    background-color: #edbf9d;
    text-decoration: none;
    color: #fff;
}
#nav-mobile {
    position: relative;
    display: none;
}
#nav-mobile ul {
    display: none;
    list-style-type: none;
    position: absolute;
    left: 0;
    right: 0;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
    background-color: #000;
    z-index: 10;
    padding: 0px;
    border-bottom: solid 1px #171717;
}
nav#nav-mobile li:last-child {
    border-bottom: none;
}
nav#nav-mobile ul {
    padding: 0;
    margin: 0;
}
nav#nav-mobile a {
    display: block;
    color: #fff;
    padding: 10px 0px;
    text-decoration: none;
    border-bottom: 1px solid #3a3a3a;
    text-align: left;
}
nav#nav-mobile a:hover {
    background-color: #111;
    color: #fff;
}
nav#nav-mobile li {
    display: block;
}

nav#nav-mobile {
    display: none;
}

@media all and (max-width: 900px) {
    #nav-trigger {
        display: block;
    }
    #nav-main {
        display: none!important;
    }
    nav#nav-mobile {
        display: block;
    }
}
@media screen and (max-width : 699px) {
#nav-wrapper {
 width: 100%;
margin : 0em;
padding: 0px;
}
}

You can make some major changes by replacing the #000 background-color with your desired colour. This will change the look and feel of your menu bar.

Step 2- Adding the HTML code
To add the menu, go to the html of your theme and search for </header> now add the html code below immediately after/below it for better results, you can as well search for <header> and place the code below before/above it if you want your menu list to appear before your header.

<div id='nav-wrapper'>
<nav id='nav-main'>
    <ul>
    <li><a class='homer' href='#'><i class='fa fa-home'/> HOME</a>
    </li>
<li><a href='/p/about.html'>About</a>
</li>
<li><a href='/p/contact.html'>Contact</a></li>
<li><a href='/p/copyright.html'>Copyright</a></li>
<li><a href='/p/privacy.html'>Privacy Policy</a></li>
<li><a href='/p/disclcoder.html'>Disclaimer</a></li>
<li><a href='/p/terms.html'>Terms</a></li>  
  </ul>
</nav>
<div id='nav-trigger'>
    <span><i class='fa fa-list fa-2x'/></span>
</div>
<nav id='nav-mobile'/> 
</div>

Please replace page links with the correct links in your blog if necessary. You can add more links by
editing and pasting this <li><a href='LINK HERE'>LINK TITLE</a></li> below </ul>


Step 3- Adding the JavaScript code
Now search for </body> and paste the code below just above it.

<script type='text/javascript'>
//<![CDATA[
$undefineddocument).readyundefinedfunctionundefined){
    $undefined"#nav-mobile").htmlundefined$undefined"#nav-main").htmlundefined));
    $undefined"#nav-trigger span").clickundefinedfunctionundefined){
        if undefined$undefined"nav#nav-mobile ul").hasClassundefined"expanded")) {
            $undefined"nav#nav-mobile ul.expanded").removeClassundefined"expanded").slideUpundefined250);
            $undefinedthis).removeClassundefined"open");
        } else {
            $undefined"nav#nav-mobile ul").addClassundefined"expanded").slideDownundefined250);
            $undefinedthis).addClassundefined"open");
        }
    });
});
//]]>
</script>
And that's it...
Save your template, check your blog and enjoy! Encountered any problem?
Let me know in the comment box.

Comments

Popular posts from this blog

Earn While you Save With Alat.ng

If you've always wanted to save up for the future, but didn't take actions for reasons best known to you, now is the time to reconsider your thoughts and take actions, because there is a digital bank known as ALAT waiting to be utilized. What Is A Digital Bank? According to Avoka.com; "Digital banking is the digitization (or moving online) of all the traditional banking activities and programs that historically were only available to customers when physically inside of a bank branch." What is ALAT? ALAT is a digital bank, the first if its kind in Nigeria! It is an innovation of Wema Bank Nigeria, developed to give you easy access to saving your funds and doing other bank transactions without being physically present at the bank.  With Alat digital bank, you can open a savings account using your phone number and Bank Verification Number (BVN) as well as other documents that you will be prompted to upload during the registration process. It’s simple, convenient, reliabl...

How To Add Instagram Feed To Your Blog

You probably have an Instagram account and would want to showcase your pictures in your blog. Adding an Instagram widget to your blog goes beyond just showcasing your account to gaining followers, who wouldn't want more followers? This post will be your guide in embedding an Instagram feed into your blog. For people do not use or have an idea of Instagram, to let you know about the beautiful platform, I will run through it briefly.  Instagram is an online photo and video sharing network which let you share photos and videos straight from your mobile device to your account for your followers viewing pleasure. With Instagram, you can automatically share your photos and videos on social media networks such as Facebook, Twitter, Tumblr, and Flickr. I will be sharing a couple of tutorials with you today that not require a plugin, and can be used on either WordPress or Blogger platform, although I will center more on blogger users. There are many websites that could work ...

An Unbiased Infolinks Review

Today, I will be going over the adnetwork, infolinks.com in my own way. let's find out if it is a good adsense alternative or one that can be used with adsense. Discovering Infolinks I found out about infolinks while searching for AdSense alternatives when I was unable to get AdSense approved for my account, Then I applied with my previous blog but darn, the blog probably did not meet their demands and I was never approved. Few months laters I got AdSense approved for my blog but that didn't live long enough, to my detriment and after been blown off by the infamous Adsense Disablement ish (made me ditch my previous blog)... Months after setting up my new blog, I had to look for an AdSense alternative, and every research I made, didn't exclude Infolinks, and this made me think highly of them and so I had to give an application another shot, this time within a day, I got approved to display ads on my blog... Bam! Such a nice achievement... Getting To Understa...