Reputation: 67
Lets get straight to it: the theory is an accordion which is one way - clicking on a header in the accordion will slide down content and clicking on a separate div inside will slide its parent (the header) back up. I want to use this as I would prefer an accordion which doesn't just slide back up whenever another header is clicked. Actually, as I don't know too much jquery, my theory probably won't work, so if there're any easier alternatives out there I'll use them! This is what I've got so far, but it's definitely not working. I hope this isn't too vague:
$('#nav > li > a').click(function() {
$(this).find(:first-child).slideDown(200); });
Upvotes: 1
Views: 82
Reputation: 2248
I think this is what you want.
There is a plugin
In this the accordion tab will not closed even when you opened the next tab.
If you want to close it try this
Also check some in useful plugins in this Site
If you need the code Then this is what we do in it
function() {
var instance = this;
// open / close item
this.$items.find('a:first').bind('click.accordion', function( event ) {
var $item = $(this).parent();
// close any opened item if oneOpenedItem is true
if( instance.options.oneOpenedItem && instance._isOpened() && instance.current!== $item.index() ) {
instance._toggleItem( instance.$items.eq( instance.current ) );
}
// open / close item
instance._toggleItem( $item );
return false;
});
Upvotes: 1