Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Help with jQuery Accordion Re: Help with jQuery Accordion

#68065
JaredAM
Member

You’ll have to use mouseover and mouseout

Code:
$(document).ready(function($) {
$(‘#accordion dd’).hide();
$(‘#accordion dt a’).mouseover(function(){
$(‘#accordion dd’).slideDown();
});
$(‘#accordion dt a’).mouseout(function(){
$(‘#accordion dd’).slideUp();
});
});

I’m not sure what the return false was supposed to do, but if you’re only going to have one element slide up and down you can use the $(‘#accordion dd’) selector instead of $(this).parent().next().

$(this).parent().next() would be useful if you’re going to have a bunch of things being shown/hidden as in Chris’ example (which is also why the .hide was inside the hover function).