Fx.accordion Error When using alwaysHide: true

56 views
Skip to first unread message

Jeremy B

unread,
Oct 21, 2009, 10:00:39 AM10/21/09
to mootool...@googlegroups.com
I am getting an error when trying to create a nested accordion and trying to make it so you can close all of the accordion panels.

I have posted a sample on mooshell:
http://mooshell.net/kxYpt/


This is the error I am getting in firebug:

el is undefined
file:///mootools-1.2.4.1-more.js
Line 221

This is line 221 in my mootoos-more.js file
221 el.setStyle('height', 'auto');



It seems like it may be a bug, but I am not entirely sure, perhaps is it due to me trying to nest accordions?
Any help is greatly appreciated,
Jeremy

Piotr Zalewa

unread,
Oct 23, 2009, 9:32:14 AM10/23/09
to mootool...@googlegroups.com
code simplified a bit
the problem is with the display: -1
don't even know if it is the right usage - it's working if commented out
http://mooshell.net/kxYpt/1

zalun
--
London, UK

Oskar Krawczyk

unread,
Oct 23, 2009, 10:44:52 AM10/23/09
to mootool...@googlegroups.com
Yup, a bug inside the .display method:

if (this.options.returnHeightToAuto) {
var el = this.elements[index];
el.setStyle('height', 'auto');
};

Needs to be changed to:

if (this.options.returnHeightToAuto && index >= 0) {
var el = this.elements[index];
el.setStyle('height', 'auto');
};

Aaron Newton

unread,
Oct 23, 2009, 3:45:09 PM10/23/09
to mootool...@googlegroups.com
will fix for next release. hopefully monday.

Oskar Krawczyk

unread,
Oct 23, 2009, 3:51:57 PM10/23/09
to mootool...@googlegroups.com
I've already requested a pull with the fix...

Aaron Newton

unread,
Oct 23, 2009, 3:55:21 PM10/23/09
to mootool...@googlegroups.com
dangit. I didn't see it. I just implemented it. I'll resolve it.

Steve Onnis

unread,
Oct 23, 2009, 7:15:04 PM10/23/09
to mootool...@googlegroups.com
I use

display : null

soundseller

unread,
Oct 24, 2009, 8:19:09 AM10/24/09
to MooTools Users
@oscar I tried your fix but
it still does not work as expected.
If I try to close all elements, the accordion snaps open again.
Any ideas?
I use following code:
var accordion = new Accordion($$('.toggler'),$$('.element'), {
opacity: 0,
alwaysHide: true,
onActive: function(toggler) { toggler.setStyle('color',
'#000000'); },
onBackground: function(toggler) { toggler.setStyle('color',
'#666666'); }
});





On Oct 24, 3:15 am, "Steve Onnis" <st...@cfcentral.com.au> wrote:
> I use
>
> display : null
>
> -----Original Message-----
> From: Piotr Zalewa [mailto:zal...@gmail.com]
> Sent: Saturday, 24 October 2009 12:32 AM
> To: mootool...@googlegroups.com
> Subject: [Moo] Re: Fx.accordionError When using alwaysHide: true
>
> code simplified a bit
> the problem is with the display: -1
> don't even know if it is the right usage - it's working if commented outhttp://mooshell.net/kxYpt/1
>
> zalun
> --
> London, UK

Jeremy B

unread,
Oct 24, 2009, 11:34:13 AM10/24/09
to mootool...@googlegroups.com
Yeah I put the fix into my mootools-more and the JS error is gone, but the accordion does snap back open after it closes.

Jeremy Bueler
www.jbueler.com

davidck

unread,
Oct 24, 2009, 1:08:35 PM10/24/09
to MooTools Users
Jeremy, I noticed the issue you pointed out as well.

I fixed it by setting the new option returnHeightToAuto to true or
false. Forgot which one, basically the opposite of the default boolean
value.



On Oct 24, 11:34 am, Jeremy B <jbue...@gmail.com> wrote:
> Yeah I put the fix into my mootools-more and the JS error is gone, but the
> accordion does snap back open after it closes.
>
> Jeremy Buelerwww.jbueler.com
>

Oskar Krawczyk

unread,
Oct 24, 2009, 1:34:20 PM10/24/09
to mootool...@googlegroups.com
Indeed, setting it to FALSE will fix the issue you're experiencing (it's basically, keeping height: 0 instead of applying height: auto).

It's odd to me that after some extensive re-facotring of the Accordion class, no one actually tested it thoroughly.

Aaron Newton

unread,
Oct 24, 2009, 3:04:09 PM10/24/09
to mootool...@googlegroups.com
we tested all the unit tests that were written, but we obviously didn't have one written for this particular option. I'll put some work into it this weekend so that it works as expected.
Reply all
Reply to author
Forward
0 new messages