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

#Day2: Overcoming Procrastination

Have you ever tried getting rid of procrastination but find yourself procrastinating about doing what's needed to be done? # Day2 of my 30 days on a Confused State of Mind. Today, it's about overcoming my biggest struggle, Procrastination. In case you missed #DAY1 Of my Confused State of mind, You can go read it >>>>  Discovering my self-worth 99% of times, I find myself procrastinating but worrying over the fact that I can't fight it! Like whom ever said I couldn't fight it? It's a rough fight and I'm always at the losing end. I feel bad about the fact that I go through this but I'm not ashamed to admit it. Probably spiting it out is one of the ways I've got to fight it. Who Else Rows the Boat? The act of postponing and procrastinating isn't peculiar to me, definitely there are a lot more people out there struggling even worse than I. But it doesn't matter, because we are all birds of a feather!  Obviously, it feels so bad to b...

How To Expand Your Wordpress Ping List

WordPress ping list are indeed useful when you want to extend your blog reach to major search engines. If you are not aware of pinging feature in WordPress, then be aware now! :) When ever you publish, edit or modify a post, WordPress sends ping to all the Ping services which must have been listed under your ping update service. So this way, ping services get notified about new post and search engine will quickly index them. Now by default WordPress notifies all major ping services but we can always extend our limit by pinging more services. adding them manually is an option definitely.  Below is a list of ping services for WordPress , which will help you to ping more services. You can also copy the list from WordPress doc file http://rpc.icerocket.com:10080/ http://blogsearch.google.com/ping/RPC2 http://1470.net/api/ping http://api.feedster.com/ping http://api.moreover.com/RPC2 http://api.moreover.com/ping http://api.my.yahoo.com/RPC2 http://api.my.yahoo.com...

I Hate Captchas, We All Hate Google Recaptcha

A good number of internet users if not all have come across and solved a captcha. Captchas are antibot checkers employed by websites to impede scam and spam. but these captchas are somewhat annoying and the latest and now most popular member of the captcha family, Google recaptcha, keeps popping up here and there in an absolutely unbearable and annoying manner. Solving captchas over the years have become somewhat harder and uncalled-for, especially with the spread and popularity of Google recaptcha. Solving captchas used to be fun and easier when users had to type in words and numbers as seen correctly but now reverse is the case as most websites have began using google recaptcha and recently, in order to have access to some websites, you need to prove that you are human! obnoxious I must say! To avoid getting stressed over selecting all roads, cars or signs, you could simply use Google Chrome browser. It's sickening that out of 10 sites you visit in a day, at...