Menu Close Menu

JQUERY: Simple Accordion Drop Down Menu With Jquery & CSS

Accordion screen shot

A lot of Blogger users are having problem getting the correct accordion menu to show up your blog recipes. In this tutorial I am going to show you how to add a jQuery accordion menu in blogger blog. Most of the time it is possible to create very functional website navigations with just CSS, but this time we are going to need a little jQuery magic to accomplish the accordion functionality. Before that, lets first talk a bit about why you would want to add accordion menu?  Well some people think that it will help with the SEO. But we think that the main reason why you would want to use them is to offer a better user experience on your site.

 

This tutorial requires you to have fair understanding of HTML, CSS.

 

Features: V 1.0

  • Standard Expand/Collapse functionality.
  • Activate/Deactivate whenever a 'click' event occurs.
  • The Accordion plugin provides support for unlimited number of levels.
  • The plugin could easily be customized and used with any website.
  • It allows multiple instances of the accordion on the same page.

and in future we will try to add some design update, functionality and much more..

 

Live Preview

 

How to add it to blogger blog

 

  1. Blogger: Go to Template > Edit HTML.
  2. Locate the ]]></b:skin> tag end of the style sheet.
  3. Copy the code below and insert it right above the tag.

#accor-wrap{
    width: 350px;
    font-family:Verdana, Geneva, sans-serif;
    margin-left: auto;
    margin-right: auto;
    }
.accordionButton {   
    width: 325px;
    float: left;
    background: #fff url(https://dl.dropboxusercontent.com/u/223738947/Demos/Jquery%20Accordion%20Menu%20For%20Blogger/Images/bg-shade-light.png) repeat-x bottom left;
    font-size: 14px;
    font-weight: bold;
    color: #555;
    border-bottom: solid 1px #ddd;
    padding: 3px 0px;
    cursor: pointer;
    padding: 5px 10px;
    text-shadow: #fff 0px 1px 0px;
    }

  .accordionButton  span {
    float:right;
    margin-right: 10px;
    color:#555;
    border: 1px dotted #555;
    display:inline-block;
    }
.accordionContent {   
    width: 325px;
    float: left;
    background: #444;
    font-size:12px;
    display: none;
    padding: 5px 10px;
    margin: 0 auto;
    }
.accordionContent ul {
    float: left;
    width:300px;
    margin:0 auto;
    padding:10px 10px;
}
.accordionContent li {
    list-style: none;
    list-style-image: none;
}
.accordionContent li a {
    background: #555 url(https://dl.dropboxusercontent.com/u/223738947/Demos/Jquery%20Accordion%20Menu%20For%20Blogger/Images/bg-shade-light.png) repeat-x 0 100%;
    display:block;
    font-family:Arial, sans-serif,Helvetica;
    font-size:12px;
    font-weight: bold;
    overflow:hidden;
    color:#555;
    border: none;
    text-decoration:none;
    position:relative;
    width:100%;
    line-height:20px;
    text-transform:capitalize;
    padding:5px 0 10px 5px;
    text-shadow:0px 1px px #fff;
        }
.accordionContent li a:hover{
    background: #b3b3b3 url(https://dl.dropboxusercontent.com/u/223738947/Demos/Jquery%20Accordion%20Menu%20For%20Blogger/Images/bg-shade-medium.png) repeat-x 0 100%;
    text-shadow:none;
    color: #fff;
    text-decoration:none;

}

 

  1. Locate the </head> tag in the middle of your template.
  2. Copy the code below and insert it right above the tag. 

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"> </script>
<script type="text/javascript" src="https://dl.dropboxusercontent.com/u/223738947/Demos/Jquery%20Accordion%20Menu%20For%20Blogger/JavaScript/Accordion.js"</script>

 

  1. Go to Layout.
  2. Click Add A Gadget.
  3. In Add A Gadget window, select HTML/Javascript .
  4. Copy the code below and paste it inside the content box.
  5. Save the gadget.
  6. Drag the gadget and reposition it where you want to show gadget.
  7. Click Save button (top right hand corner).

    <div id="accor-wrap">
<!-- Dropdown 1 -->      

<div class="accordionButton">Top Blogger widget 2014 <span>&#9660;</span></div>
        <div class="accordionContent">
        <ul>
        <li><a  href="#" >1. Floating Sharing Bar</a></li>
                    <li> <a  href="#">2. Facebook Poput Like Box</a></li>
                    </ul>
        </div>
<!-- End Dropdown 1 -->

<!-- Start Dropdown 2 -->       

<div class="accordionButton">Top SEO Articles <span>&#9660;</span></div>
        <div class="accordionContent">
        <ul>
        <li><a  href="#"> 1. Search Engines That Respect Privacy </a></li>
                    <li> <a  href="#"> 2. The SEO Tools That Help Boost Your Sites Traffic </a></li>
                    </ul>
      </div>

<!-- End Dropdown 2 -->

<!-- Dropdown 3 -->


        <div class="accordionButton">Top Best Blogger Template <span> &#9660; </span> </div>
        <div class="accordionContent">
             <ul>
        <li><a  href="#" >1. Blogger Beginner</a></li>
                    <li> <a  href="#">2. Premium Blogger Template</a></li>
                    <li> <a  href="#">3. Sky Blue Blogger Template</a></li>
                    </ul>
        </div>
     <!-- End Dropdown 3 -->  

<!-- Dropdown 4 -->

<div class="accordionButton">Top Blogger Resources & Tools <span>&#9660;</span></div>
        <div class="accordionContent">
             <ul>
        <li><a  href="#" >1. HTML Econder</a></li>
                    <li> <a  href="#">2. HTML Editor</a></li>
                    </ul>
        </div>

<!-- End Dropdown 4 -->
    </div>

 

Troubleshooting for setting up for your blog

In the above html code we have created 4 accordion menu.

 

  • Replace Highlighted in yellow with the name of the dorp down title.
  • Replace Highlighted in Green with your Link anchor text.
  • Replace hash (#) sign with your article (page) link.

So now we sure you want to add another dropdown, So then just add the following code after

<!--end dropdown 4 –->

<div class="accordionButton">here is the title For your new dropdown <span>&#9660;</span></div>
        <div class="accordionContent">
             <ul>
        <li><a  href="#" >here is your anchor text </a></li>
                    <li> <a  href="#">here is your anchor text </a></li>
                    </ul>
        </div>

 

We hope that you will find this article useful and it will help you create cool looking accordion menu. Have Any Questions? Leave them in comments below and don’t forget to share.

"Be the first to express your thoughts"

Post a Comment

Important - Make sure to click the "Subscribe By Email" link below the comment for to be notified of follow up comments and replies.If you use Name/URL don't use keywords as your name. We love to hear from you! Leave us a comment.
To ensure proper display, HTML/XML/JavaScript need to be Encode first using this Encoder Tool Then paste the Encoded code here.