Accordian transparency and first selected...
Hi coming from Mootools and beeing pretty new to JS,
I'd tried to implement JQ on a site. That works nice but I've two or three minor questions.
This is my code
-
$(document).ready(function() {
$('div.accordion> div').hide();
$('div.accordion> h3').click(function() {
var $nextDiv = $(this).next();
var $visibleSiblings = $nextDiv.siblings('div:visible');
if ($visibleSiblings.length ) {
$visibleSiblings.slideUp('normal', function() {
$nextDiv.slideToggle('slow');
});
} else {
$nextDiv.slideToggle('slow');
}
});
});
My questions:
1st: Is there a way to add to this code/behavior a smooth 'fade' on UP and DOWN of the
text? I tried to experiment with opacity but didn't get it.
2nd: At the moment I use two different JSs because in some HTML pages I need the first node 'opened' in some not. Is there an easy way to add to the code above an extra 'selector' similar to
-
$('div.accordion div:not(:first)').hide();
but within one file?
Last: Using this 'not hide' does not activate the first node via css - any idea how to do this? - I'm sure this cool peace of SW is able to...
Sorry I'm a bit under pressure and not familiar with JS/JQ.
cheers
E.