Results 1 to 3 of 3

Thread: Animated collapse call from other file

  1. #1
    Join Date
    Jun 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Animated collapse call from other file

    1) Script Title: Animatedcollapse

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...edcollapse.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

    Thanks

  2. #2
    Join Date
    Aug 2004
    Posts
    9,896
    Thanks
    3
    Thanked 967 Times in 955 Posts
    Blog Entries
    15

    Default

    Please elaborate what you mean by calling the script from another JavaScript file. The initiliazation code for the script:
    Code:
    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:

    Code:
    <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>
    
    <script src="myfile.js"></script>

  3. #3
    Join Date
    Jun 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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 :

    Code:
    animatedcollapse.addDiv('page_content','fade=1')
    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

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •