PDA

View Full Version : Animated Collapsible DIV: What if I have hundreds of DIVs?



smansakra
08-21-2008, 04:54 AM
1) Script Title: Animated Collapsible DIV

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

TheJoshMan
08-21-2008, 04:55 AM
do you want each of those 47 divs to "animate"?

smansakra
08-21-2008, 05:07 AM
yes, on my site there are 47 div , i use onclick ->display-> block to display each div if my member click "answer this post".

Nile
08-21-2008, 05:07 AM
Put this in the <head> section of your page:


<script type="text/javascript">
for(i=1;i<=47;i++){
animatedcollapse.addDiv('posting_'+i+,'fade=1');
}
animatedcollapse.init();
</script>

It should work.

mburt
08-21-2008, 05:08 AM
<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"

Nile
08-21-2008, 05:10 AM
Mburt makes a fix, lol.

smansakra
08-21-2008, 05:16 AM
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!

smansakra
08-21-2008, 08:11 AM
:) 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?

smansakra
08-21-2008, 08:22 AM
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?

smansakra
08-21-2008, 09:28 AM
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...

smansakra
08-22-2008, 10:28 AM
please see the picture below...
this is a picture from one of my member, if the logged member click on "answer" link, it will displayed hidden "wysiwyg text area", the answer link will call "id name" of div of that text area.

http://i59.servimg.com/u/f59/11/39/20/36/postin10.jpg

can anyone help?

Nile
08-22-2008, 07:59 PM
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?


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...

Well, with the first quote I posted. I really don't suggest making it unlimited, because then it would just keep going, and it could take years. Excuse me, did I say years? I mean forever(and that's not over exaggerating). It would keep going on and on forever.

And for my second quote. WTF? What does that mean?

smansakra
08-23-2008, 10:16 AM
:rolleyes: HI, WTF what? i didn't post any "WTF" !

smansakra
08-23-2008, 10:46 AM
hi look, i did not post any WTF?
what is WTF?

hum may we "WHAT THE FUC******" ! :D ha ha ha LOL...!

Nile
08-24-2008, 02:52 AM
I did not mean that you said this. I meant, "", as in. I don't understand it, and if you were to go back and read your post(I'm not trying to offend you, honsetly), you probably couldn't find out what it said

So could you please rephrase it?

smansakra
08-27-2008, 12:16 PM
hello....
hi i have just finished it...
sorry for my post becouse it is difficult to be understood