A mootools-powered slide down div question...

bamme

Senior Member
Hi everyone

I'm a beginner with jquery/javascript but this is the first time ive looked at mootools.. :S

Im having a bit of trouble figuring how to do something with the toggling slide down/up divs featured here:

Club Charts, Pop & Dance mp3s - Sam Smith UK Pop & Dance Artist

I'd like to know if its possible to make one music list collapse if the other is clicked - therefore having just one open at a time?

Can anyone help? Or direct me to a resource? I dont really mind if its from a diff library, but itd be ideally using mootools, or in javascript - as other parts of the site use mootools.

:S
 
I can tell you how to with jquery but am not familar with mootools.

With jQuery

$(document).ready(function() {

//ACCORDION BUTTON ACTION
$('div.accordionButton').click(function() {

if($(this).next().is(':visible')) {
$('div.accordionContent').slideUp('normal');
} else {
$('div.accordionContent').slideUp('normal');
$(this).next().slideDown('normal');
}
});

//HIDE THE DIVS ON PAGE LOAD
$("div.accordionContent").hide();
});

your div's should have the class accordionButton and accordionContent respectivley.

source - Stupid Simple jQuery Accordion Menu

although I would advise you research/work it out with mootools if you've used that for everything else. It doesn't make sense to load both libaries when they can both do the same.
 
thanks very much - I did think myself to perhaps remove mootools and replace all the effects currently in place with jquery, think this will be quicker overall!

Thanks for the help :)
 
Back
Top