Saturday, 28 March 2009 17:23
I wrote a little jQuery script for accordion menus. Hope you like it:
First, create your HTML markup as follows:
<div id="sel"> <h4>title 1</h4><div>content 1</div> <h4>title 2</h4><div>content 2</div> </div>
Then add this to your javascript:
/* jeff's tiny accordian */ var aMenu = function( sel ) { $(sel+' div').hide(); $(sel+' h4').click(aMenuClick); } var aMenuClick = function() { $(this).next('div').slideToggle(500).siblings('div').slideUp(500); return $(this).next('div').length > 0 ? false : true; } $(window).bind( 'load', function() { aMenu( 'div#sel' ); } );
Last Updated on Sunday, 26 April 2009 21:14
Comments (1)
Add your comment
Featured Extensions
|
$3.00
FREE You Save: $3.00 |
$1.00
FREE You Save: $1.00 |
$5.00
FREE You Save: $5.00 |
$1.00
FREE You Save: $1.00 |
Latest Articles
Most Popular
The Joomla!® name is used under a limited license from Open Source Matters in the United States and other countries. Jeff Channell is not affiliated with or endorsed by Open Source Matters or the Joomla!® Project.




$(window).bind('load', function() {
$('div#sel div').hide();
$('div#sel h4').click(function() {
$(this).next('div').slideToggle(500).siblings('div').slideUp(500);
});
});
If you had another intention for all the extraneous code you should have said so