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

Thread: Animated Collapsible DIV: What if I have hundreds of DIVs?

  1. #1
    Join Date
    Aug 2008
    Location
    karanganyar, solo, indonesia
    Posts
    161
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Question Animated Collapsible DIV: What if I have hundreds of DIVs?

    1) Script Title: Animated Collapsible DIV

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

    3) Describe problem:


    hi all, to make our collapsible works , we should inser it :
    <script type="text/javascript">

    animatedcollapse.addDiv('jason', 'fade=1,height=80px')
    animatedcollapse.addDiv('kelly', 'fade=1,height=100px')
    animatedcollapse.addDiv('michael', 'fade=1,height=120px')
    animatedcollapse.init()

    </script>
    on the head section.

    and then on body we should have the coresponds div.


    but what about if on my body contains hundreds of div?
    like below
    <div id="posting_1"
    <div id="posting_2"
    <div id="posting_3"
    <div id="posting_4"
    <div id="posting_5"
    <div id="posting_6"
    and so on until 47.

    should i write on my head section something like:
    <script type="text/javascript">

    animatedcollapse.addDiv('posting_1', 'fade=1')
    animatedcollapse.addDiv('posting_2', 'fade=1')
    animatedcollapse.addDiv('posting_3', 'fade=1')
    animatedcollapse.addDiv('posting_4', 'fade=1')
    animatedcollapse.addDiv('posting_5', 'fade=1')
    animatedcollapse.addDiv('posting_6', 'fade=1')

    and so on until 47
    animatedcollapse.init()

    </script>

    can anyone here give smarter solution? please thanks

  2. #2
    Join Date
    Jan 2006
    Location
    Ft. Smith, AR
    Posts
    795
    Thanks
    57
    Thanked 129 Times in 116 Posts

    Default

    do you want each of those 47 divs to "animate"?
    --------------------------------------------------
    Reviews, Interviews, Tutorials, and STUFF
    --------------------------------------------------
    Home of the SexyBookmarks WordPress plugin

  3. #3
    Join Date
    Aug 2008
    Location
    karanganyar, solo, indonesia
    Posts
    161
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Question yes

    yes, on my site there are 47 div , i use onclick ->display-> block to display each div if my member click "answer this post".

  4. #4
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Put this in the <head> section of your page:
    Code:
    <script type="text/javascript">
    for(i=1;i<=47;i++){
    animatedcollapse.addDiv('posting_'+i+,'fade=1');
    }
    animatedcollapse.init();
    </script>
    It should work.
    Jeremy | jfein.net

  5. #5
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    Code:
    <script type="text/javascript">
    for (var i = 1;i <= 47;++i){
      animatedcollapse.addDiv(("posting_"+i), "fade=1");
    };
    animatedcollapse.init();
    </script>
    You had an extra "+" after the "i"
    - Mike

  6. The Following User Says Thank You to mburt For This Useful Post:

    Nile (08-21-2008)

  7. #6
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Mburt makes a fix, lol.
    Jeremy | jfein.net

  8. #7
    Join Date
    Aug 2008
    Location
    karanganyar, solo, indonesia
    Posts
    161
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default

    hi, thanks man! OK , i will try it, i'm new in javascript but i have 7 month experience in php.
    thanks , if i found error i will post again...

    cheerr!

  9. #8
    Join Date
    Aug 2008
    Location
    karanganyar, solo, indonesia
    Posts
    161
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Unhappy hi , what about this?

    hi , this works fine :

    for ( var i = 1; i<47 ++i){
    animatedcollapse.addDiv(('answer_form_to_'+i), 'fade=1');
    }

    but, how to make unlimited?
    i'm trying do this but not work

    for ( var i = 1; ++i){
    animatedcollapse.addDiv(('answer_form_to_'+i), 'fade=1');
    }

    CAN ANYONE HELP?

  10. #9
    Join Date
    Aug 2008
    Location
    karanganyar, solo, indonesia
    Posts
    161
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default

    and this does'nt work either
    var i =0;
    while (i >0)
    {
    animatedcollapse.addDiv(('answer_form_to_'+i), 'fade=1');
    i=i+1;
    }

    any suggestion?

  11. #10
    Join Date
    Aug 2008
    Location
    karanganyar, solo, indonesia
    Posts
    161
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default no answer?

    no answer?
    hum the problem with my site is
    not about:
    <div id="posting_1"
    <div id="posting_2"
    <div id="posting_3"
    <div id="posting_4"
    <div id="posting_5"
    <div id="posting_6"

    but
    <div id="posting_132"
    <div id="posting_31"
    <div id="posting_4"
    <div id="posting_26"
    <div id="posting_522"
    <div id="posting_61"

    and so on...

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
  •