Ok, after a real battle with the DOM (traveled up and down many times, still
tired ;-)))
i came up with the next solution :
$('.Show_hide').Accordion({
active: false,
alwaysOpen: false,
showSpeed: "slow",
hideSpeed: "slow"
}).change(function(){
$('.Show_hide
.selected').next('.Show_text:hidden').prev('.Show_item').each(function(){
$(this).removeClass('selected');
$(this).addClass('notSelected');
});
});
The puropse of the .change is to catch the click of an element when the
accordion moves in (all items can be hidden (alwaysOpen=false)) and the
class stays selected but shoud revert to notSelected.
Q : I do not know if this is the best way to do it, the .change is - not
sure about DOM traveling - my first minor JQ experience.
Especially the .each- there is only 1 match but can the .addClass and
.removeClass be chained after the .prev() ?!?!?
The HTML that goes with it :
<div class="Show_hide"> <!-- /* Traject List */ -->
<h3 class="Show_item first">Dagbesteding</h3>
<dl class="Show_text Traject_def"> <!-- /* Begin uitleg
traject */ -->
<dt>Doel</dt>
<dd>Etc</dd>
</dl>
<h3 class="Show_item">Tadda</h3>
<dl class="Show_text>
....
</dl>
<h3>
etc ....
</div>
Grtz:C
Hi Jörn
First of all - i love this widget :-))
Second - i had seen the .change in your doc but was not sure if i should go
with that or there was another possibility - i will have a look at .change -
i am a bit of newbie in Jquery but know where to find the docs ;-)
Grtz:cees
Sneeuw Tijger wrote:
>
>> How is this done in Jquery ? I think is has to be something like an
>> OnHide action ?!?!
>> And yes, I know i can set it to let it always display one item open
>> but that is not what my client wants :P
>
Jörn Zaefferer wrote:
>
> Currently the plugin doesn't support a "not selected" class. But you can
> add it by using the change event. There is one example in the docs:
>
> $('#accordion').Accordion().change(function(event, newHeader, oldHeader,
> newContent, oldContent) {
> $('#status').html(newHeader.text());
> });
>
> Let me know if that works for you.
>
> --
> Jörn Zaefferer
>
>
>
--
View this message in context:
http://www.nabble.com/Accordion---onHide---onShow-actions-available--%21-%21-tf3300677.html#a9400178
Sent from the JQuery mailing list archive at Nabble.com.
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/