PDA

View Full Version : Struggling with v2.2 of Animated Collapsible DIV



russ_e
06-17-2009, 03:54 PM
1) Script Title: Animated Collapsible DIV v2.2
2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/animatedcollapse.htm
3) Describe problem:

I have used version 1 of the Animated Collapsible DIV, and it works extremely well, but I am struggling with v2.2. When I try the Developer's View code (http://www.dynamicdrive.com/dynamicindex17/animatedcollapse_dev.htm) in my html editor (Homesite), I get "Line: 98 - Error: Object expected" when flipping from the code view to browse view, and then when trying to activate anything in the browse view I get "Line: 52 - Error: 'length' is null or not an object".

I have put the exact code of the Developer's View up here (http://homepage.ntlworld.com/russelliott/collapsible-new-developer.html) as a test page (together with the animatedcollapse.js file in the same directory), but it does not seem to work for me. (I am looking at it in IE8, and I do not currently have any additional javascript pack installed on my machine.)

Btw, what is the function of the jquery.min.js script file? I get the same errors as reported above whether this file is present or absent.

russ_e
06-17-2009, 09:48 PM
Btw, what is the function of the jquery.min.js script file? I get the same errors as reported above whether this file is present or absent.

Apologies - the above last sentence of mine wasn't correct at all! :o

I think I've found the problem, having read DD's blog on "Using Google to host your jQuery (or other) JavaScript libraries" (http://www.dynamicdrive.com/forums/blog.php?b=11). That blog highlights the issue of what and where to host, and, pertinently, external library references changing. On the page notified in my initial post (http://homepage.ntlworld.com/russelliott/collapsible-new-developer.html), I had used:

<script type="text/javascript" src="jquery-1.2.2.pack.js"></script>

in the header, as is cited in the Developer's View (http://www.dynamicdrive.com/dynamicindex17/animatedcollapse_dev.htm) page. It appears this is an instance of where the external library reference is now out of date, so I've used:

<script type="text/javascript" src="jquery.min.js"></script>

This is available as an external link of course (http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js), but with libraries chopping and changing, I think my preference is to host it locally.

Script works fine now. (See here (http://homepage.ntlworld.com/russelliott/collapsible-new-developer2.html).) Problem now solved. :)