Live Preview
Accordion Menu Features
- Elegant Flat Design.
- FontAwesome Icons .
- Jquery Slideup Easing Effect.
- Standard Expand/Collapse functionality.
- Activate/Deactivate on 'click' event.
- The Accordion plugin provides support for unlimited number of levels.
- The plugin could easily be customized and used with any website.
Setup font-awesome, accordion script and jquery into your blog
Setting up Font Awesome can be as simple as adding two lines of code to your website, or you can be a pro and customize the LESS yourself!
- Go to your Blogger Dashboard >> Template
- Click Edit HTML
- Paste the following code right after opening <head> tag(Need Help?)
<!-- Jquery -->
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js'> </script>
<!--Font and iconic Font -->
<link rel='stylesheet' href='http://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css'/>
<link href="http://fonts.googleapis.com/css?family=Lato:300,400" rel="stylesheet" type="text/css"/>
- Paste the following code right before closing </body> tag(Need Help?)
<!-- Accordion -->
<script type='text/javascript'>
$(document).ready(function(){
//ACCORDION BUTTON ACTION
$('div.accordionButton').click(function() {
//IF THE DIV YOU CLICKED IS ALREADY OPEN, CLOSE AND REMOVE THE OPEN CLASS
if ($(this).next().hasClass('openDiv')) {
$('div.accordionContent.openDiv').slideUp('2000');
$('div.accordionContent.openDiv').removeClass('openDiv');
}
//CLOSE ANY OPEN DIVS, OPEN THE CLICKED DIV
else {
$('div.accordionContent.openDiv').slideUp('2000');
$('div.accordionContent.openDiv').removeClass('openDiv');
$(this).next().slideDown ('1000');
$(this).next().addClass('openDiv');
}
});
//HIDE THE DIVS ON PAGE LOAD
$("div.accordionContent").hide();
});
</script>
Note:-if You already using jquery and font-awesome then please skip the jquery and font-awesome link from the below code and then continue the steps below and if you wish to use another font or your template default font then please skip the "lato font" link from the code below.
Adding CSS
- Blogger: Go to Template > Edit HTML.
- Locate the ]]></b:skin> tag end of the style sheet.
- Copy the code below and insert it right above the (]]></b:skin>) tag.
#accor-wrap {
width: auto;font-family: 'lato', sans-serif;
font-weight: normal;
margin-right: auto;
margin-left: auto;
}.accordionButton {
width: 100%;
float: left;
background: #1FDEA0;
font-size: 16px;
font-weight: bold;
color: #fff;
cursor: pointer;
padding: 10px 10px;
line-height: 30px;
}.accordionButton:before {
font-family: 'FontAwesome';
content: "\f0a9";
font-size: 18px;
margin-right: 10px;
font-weight: normal;
font-variant: normal;
text-transform: none;
-webkit-font-smoothing: antialiased;
}.accordionButton:hover:before {
font-family: 'FontAwesome';
font-size: 18px;
font-weight: normal;
font-variant: normal;
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-ms-transform: rotate(45deg);
-o-transform: rotate(45deg);
transform: rotate(45deg);
-webkit-transition: all .4s ease;
-moz-transition: all .4s ease;
-o-transition: all .4s ease;
-ms-transition: all .4s ease;
transition: all .4s ease;
}.accordionContent {
width: 100%;
float: left;
background-color: #FFF;
font-size: 12px;
display: none;
padding: 0px;
margin: 0 auto;
}.accordionContent ul {
float: left;
width: 100%;
margin: 0 auto;
padding: 0px;
text-decoration: none;
}.accordionContent li {
border-bottom: 1px solid #ddd;
list-style: none;
list-style-image: none;
margin: 0 auto;
text-decoration: none;
}.accordionContent li a {
display: block;
font-size: 14px;
font-weight: 400;
overflow: hidden;
color: #7D7D7D;
text-decoration: none;
margin: 0 auto;
text-transform: capitalize;
padding: 10px 0 10px 10px;
}.accordionContent li a:before {
font-family: FontAwesome;
content: "\f061";
margin-right: 3px;
}.accordionContent li a:hover {
color: #333;
text-decoration: none;
}.accordionContent li:last-child {
border-bottom: none;
}
Now you are just one step away from success just follow the below step and visit flat accordion menu in action.
Adding HTML Into Blogger Layout
- Go to Layout.
- Click Add A Gadget.
- In Add A Gadget window, select HTML/Javascript.
- Copy the code below and paste it inside the content box.
- Save the gadget.
- Drag the gadget and reposition it where you want to show gadget.
- Click Save button (top right hand corner).
<div id="accor-wrap">
<div class="accordionButton">Top Blogger widget 2014 </div>
<div class="accordionContent">
<ul>
<li><a href="#" >Floating Sharing Bar</a></li>
<li> <a href="#">Facebook Poput Like Box</a></li>
</ul>
</div>
<div class="accordionButton">Top SEO Articles</div>
<div class="accordionContent">
<ul>
<li ><a href="#">Search Engines That Respect Privacy
by Guest blogger </a></li>
<li> <a href="#">The SEO Tools That Help Boost Your Sites Traffic </a></li>
</ul>
</div>
<div class="accordionButton">Top Best Blogger Template </div>
<div class="accordionContent">
<ul>
<li><a href="#" >Blogger Beginner</a></li>
<li> <a href="#">Premium Blogger Template</a></li>
<li> <a href="#">Sky Blue Blogger Template</a></li>
</ul>
</div>
<div class="accordionButton">Top Blogger Resources and Tools</div>
<div class="accordionContent">
<ul>
<li><a href="#" >HTML Econder</a></li>
<li> <a href="#">HTML Editor</a></li>
</ul>
</div>
<div class="accordionButton">Flat Blogger Templates</div>
<div class="accordionContent">
<ul>
<li><a href="#" >Flat Mag</a></li>
<li> <a href="#">Developer Template</a></li>
</ul>
<!-- Last DropDown -->
</div>
How To Setup Accordion Menu Links
- In the above html code we have created 5 accordion menu.
- Replace Highlighted in yellow with the name of the dorpdown title.
- Replace Highlighted in Green with your Link anchor text.
- Replace hash (#) sign with your article (page) link.
<div class="accordionButton">Flat Blogger Templates</div> <div class="accordionContent"> <ul> <li><a href="#" >Flat Mag</a></li> <li> <a href="#">Developer Template</a></li> </ul> </div>
We hope that you will find this tutorial useful and it will help you to create awesome flat accordion menu. Need further help or have questions? Leave them in comments below and don't forget to share, Soon we will share a free premium template until for stay updated by subscribing our newsletter below for free blogger resources in future. Happy Blogging..!!
Very Nice Accordion menu really liked it would love to use it on my new blog! Thanx Mohammad bhai for this amazing menu!
ReplyDeleteThanks for sharing this types of mebu
ReplyDeletebut its not show sub menu help me
ReplyDelete