Features
- It hasn't much features (you're not going to need anyway ...)
- Easy to implement.
- Supports custom Animations.
- It's small!
Screenshot
Demo
Try it here
Usage
The HTML Code:
<div class="microaccordion"> <div class="micro"> <a href="#">Title 1</a> <div>Content 1</div> </div> <div class="micro"> <a href="#">Title 2</a> <div>Content 2</div> </div> </div>
The JS Code:
$('.microaccordion').microAccordion({ cssClassOpen: 'header-open', cssClassClosed: 'header-closed', cssClassHoverOpen: 'header-hover-open', cssClassHoverClosed: 'header-hover-closed', cssClassContent: 'content', openSingle: true, closeFunction: function (obj) { obj.hide(); }, toggleFunction: function (obj) { obj.toggle(); } });
Questions or problems? Just leave a comment.
Download
Get the following file hosted on ubuntu one:
Download Here
Hi,
AntwortenLöschenFYI the "Try it here" link is reaching a page with this message:
Parse error: syntax error, unexpected T_STRING [..]
Thanks,
AntwortenLöschenI guess the site was down, I don't get this error.
I wanted to always have at least one open tab, so I added a default option:
AntwortenLöschenallowAllClosed: true
And then added the following test near the top of the click handler:
if (a.hasClass(o) && !opts.allowAllClosed && (obj.find('.' + o).length == 1)) {
return false;
}
Hey Eric, nice code! That's kinda the idea with my micro thingies ;-) providing a smallest possible (but yet working) UI Element.
AntwortenLöschenGood Work!
I like the simplicity of this accordion, a great one. I have one question, If I want start the page with all accordions collapsed, what do I need to do?
AntwortenLöschenCurrently this won't work. But I'll get this in the next version (might take a few months, since I develope these plugins when I need them in a project - and I'm quite busy at the moment :-S)
AntwortenLöschenSorry, but thanks for this idea!
Hello,
AntwortenLöschenI'm a total JS-noob, but how do you add animations? For example content that slides out.
Thank you so much, author. You JQuery Micro Accordion Plugin is so elegant and can be customized easily, that i was able to solve task i could not deal with trying other similar plugins. Thanks, mate.
AntwortenLöschenHi. How to fis this:
AntwortenLöschen$(".microaccordion").microAccordion is not a function