PDA

View Full Version : A BUG in 'Animated Collapsible DIV' script



Chupo_cro
03-24-2008, 02:36 AM
1) Script Title: Animated Collapsible DIV

2) Script URL (on DD):

http://www.dynamicdrive.com/dynamicindex17/animatedcollapse.htm

3) Describe problem:

If:

- The height attribute IS set manually
- the persistexpand parameter IS set to 'true' (use cookies)
- initstate parameter IS NOT used (so the initstate is 'contract')

the target DIV would always be expanded at the very first visit (although it shoudn't be).

The solution:

The 21st line of the JavaScript (http://www.dynamicdrive.com/dynamicindex17/animatedcollapse.js):

else if (!persistexpand && this.initstate=="contract" || persistexpand && this.isExpanded!="yes" && this.isExpanded!="")

should be changed to

else if (!persistexpand && this.initstate=="contract" || persistexpand && this.isExpanded!="yes")

for after the very first visit, this.isExpanded!="" will always be false (cookie still doesn't exist --> animatedcollapse.getCookie returns ""), so the statement this.divObj.style.height=0 is never going to be processed (as it should).

ddadmin
04-23-2008, 07:37 AM
Thanks, I'll revisit this thread the next time the script is updated to see if the fix should be thrown in.

Chupo_cro
04-24-2008, 05:31 PM
I think it should :-)