Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: Using animated collapsible DIV script in multiple locations throughout page

  1. #1
    Join Date
    Aug 2005
    Posts
    54
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Default Using animated collapsible DIV script in multiple locations throughout page

    1) Script Title: Animated Collapsible DIV

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...edcollapse.htm

    3) Describe problem: I plan on using this (example 2) multiple times on a calendar I'm creating. Does the following snippet need to be added after each instance?

    <script type="text/javascript">

    //Syntax: var uniquevar=new animatedcollapse("DIV_id", animatetime_milisec, enablepersist(true/fase), [initialstate] )
    var collapse2=new animatedcollapse("cat", 800, true)

    </script>

    Also, does the number inside the href beside the word collapse, <a href="javascript:collapse2.slideit()">, need to be increased each time? I hope this makes sense?

  2. #2
    Join Date
    Aug 2004
    Posts
    9,890
    Thanks
    3
    Thanked 964 Times in 953 Posts
    Blog Entries
    15

    Default

    The parts in red need to be unique for each different DIV content you're applying the script to:

    Code:
    var collapse2=new animatedcollapse("cat", 800, true)
    For any link/ function that manipulates a DIV, it should correspond to the unique variable for it, in this case, "collapse2":

    Code:
    <a href="javascript:collapse2.slideit()">

  3. #3
    Join Date
    Aug 2005
    Posts
    54
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Default

    Thanks.

  4. #4
    Join Date
    Sep 2007
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Lightbulb Placing multiple DIV's throughout the page

    Im just gonna tell this to those who dont understand the explanation above.
    Create as many DIV's as you want but in each DIV find this line
    Code:
    <a style="text-decoration:none" href="javascript:collapse2.slideit()">
    The piece of code marked with red corresponds to this DIV and it must be unique for each DIV you create, otherwise they wont work correctly. To make 'em work simply change the number in that piece of code to next in line. For example you have 3 DIV's on you're page then they should look like this:
    Code:
     <a style="text-decoration:none" href="javascript:collapse2.slideit()">
    <a style="text-decoration:none" href="javascript:collapse3.slideit()">
    <a style="text-decoration:none" href="javascript:collapse4.slideit()">
    As u can see I just changed the numbers. But its not all, at the end of final DIV there will be a line:
    Code:
    //Syntax: var uniquevar=new animatedcollapse("DIV_id", animatetime_milisec, enablepersist(true/fase), [initialstate] )
    var collapse2=new animatedcollapse("cat", 800, true)
    You must edit it so the other 2 DIV's will work. Its easy - just add this line
    Code:
    var collapse2=new animatedcollapse("cat", 800, true)
    as many times as you have DIV's on you're page but changing the number in highlighted piece of coding to numbers that u gave to you're DIV's. In our case it will look like this:
    Code:
    //Syntax: var uniquevar=new animatedcollapse("DIV_id", animatetime_milisec, enablepersist(true/fase), [initialstate] )
    var collapse2=new animatedcollapse("cat", 800, true)
    var collapse3=new animatedcollapse("cat", 800, true)
    var collapse4=new animatedcollapse("cat", 800, true)
    Now all you're DIV's will work correctly.

  5. #5
    Join Date
    May 2008
    Posts
    7
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    is there anyway to automatically close an open div when another is clicked upon?

  6. #6
    Join Date
    May 2008
    Posts
    7
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Using Animated Collapsible DIVS

    1) Script Title: Animated Collapsible DIV

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...edcollapse.htm

    3) Describe problem: I would like to get the DIV's on this page http://www.ascensor.co.uk/development08/paper/ to close when a new DIV is clicked upon, so no more than one can be 'open' at a time...

    is this possible?

  7. #7
    Join Date
    May 2008
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    1) Script Title: Animated Collapsible DIV

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...edcollapse.htm

    3) Describe problem: Need to know if it is possible to expand all instances of the slider at once? even when there are multiple sets on the same page.

  8. #8
    Join Date
    Aug 2004
    Posts
    9,890
    Thanks
    3
    Thanked 964 Times in 953 Posts
    Blog Entries
    15

    Default

    Urbancool and cxcawood, in the future, please start a new thread when asking your own question on a DD script.

    In a nutshell, the Animated Collapsible script is up for a rewrite, and the new version most likely will do both of what you've mentioned. ETA is probably within the next 2 weeks.

  9. The Following User Says Thank You to ddadmin For This Useful Post:

    urbancool (05-20-2008)

  10. #9
    Join Date
    May 2008
    Posts
    7
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    i apologise for my part in not starting a new thread... however, in direct response, i did also create a new thread with the same question, which it seems, everybody has bypassed completely!

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

    Default

    It would be great if the next version of the animated collapsible div would allow the div to be specified as a var, so that a dynamically generated page (I.e. a list of search results) could have an animated div for each result.

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
  •