View Full Version : Animated collapse call from other file

06-16-2008, 05:10 PM
1) Script Title: Animatedcollapse

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/animatedcollapse.htm

3) Describe problem:

I can get it running no problem while it is all within the one page, such as index however this is not what I want. I have a system controlling the menu, and it is the menu which calls the animated collpase script, but from within another JS file. I as fine with the old version of animatedcollpase however I now want to upgrade to the better, newer version but I can no longer call it from the other JS file. Is there a way around this?? Please help


06-17-2008, 03:55 AM
Please elaborate what you mean by calling the script from another JavaScript file. The initiliazation code for the script:

animatedcollapse.addDiv('jason', 'fade=1,height=80px')

can be called inside any .js file, as long as the reference to that file in your HTML comes after those for the animated collapsible div script itself:

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

* Animated Collapsible DIV v2.0- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for this script and 100s more


<script src="myfile.js"></script>

06-19-2008, 10:14 PM
Sorry should've been more clear.

the index file contains references to all the js files that are being used. individually they are all working and this is fine.

I have a menu system in javascript controlled by Menu.js
The menu loads content dynamically into a DIV tag called page_content which also works fine.

I have created the animatedcollapse div using :

followed by initialising it.

When I create a button within the index html page to run this animated collapse it works fine with no problems.

What I'm trying to do, is tell it to open and close but from within the menu.js so that when the user clicks the menu option, the menu.js opens the div and loads the content but because the div is declared in the html file it isn't finding it and simply isn't working.

If i declared it inside the menu.js would it even find a div named page_content??

What should I do.

Thanks very much