dog199200 Guest | [F] Toggle Effect {Help Plz} [F] (25th Nov 08 at 8:33am UTC) Resolved | | OK do to my forum being an rp I am using the Additional Profile Options feature for role play stats, do to this it causes the mini-profile to stretch, and well I got the idea, why not add a toggle effect , so I did and I have came across one big problem...
The toggle effect work perfectly fine when you use it in the Profile page, but when you got to a thread and you go to use it it will only toggle for the very first person in that page of the thread as you can see here
http://fmaworldsapart.vforums.co.uk/board/VideoGames/topic/221/action/view_topic/worst-games-of-2008#reply-9
Here is the javascript code I am using:
Code: - <script>
- function swapRows(rowId){
- var persist = document.getElementById(rowId).style.display;
- for(i=0;i<arguments.length;i++)
- document.getElementById(arguments[i]).style.display = (persist=="none")?"block":"none";
- }
- </script>
And here is the code for the mini-profile:
Now with all the information is, can someone please help me fix the code so that it will work per person, as well can you make it so that the table starts up instead of down, so they gave to click to display the stats. | |
|
dog199200 Guest | Re: Toggle Effect {Help Plz} (28th Nov 08 at 9:18pm UTC) | | bump | |
|
Marc vChat Developer
I <3 Rossy
Posts: 3,388 Status: Offline Gender: Male Location: Ontario, Canada Age: 32 Joined:
Additional Groups: Coding Team
pmwww | Re: Toggle Effect {Help Plz} (28th Nov 08 at 10:15pm UTC) | | An ID is an attribute that must be different for each element it is attached to. The reason it's only working for the first instance of "data1" is because ID's are only meant to be attached to one element.
To get this to work you'll need to change the ID's to classes, loop through all the TD's, find the ones with the class you're searching for, and change the visibility for all of them. | |
rroll.to— Shorten a link, rickroll your friends. |
|
dog199200 Guest | Re: Toggle Effect {Help Plz} (28th Nov 08 at 11:25pm UTC) | | OK i'll do that last, first I want to fix a small problem
Updated Table Code With Toggle:
Code: - <table width="115" cellpadding="0" cellspacing="0" border="1">
- <tr colspan"1" align="center">
- <td onClick="swapRows('data1');" class="title1">~ Forum Data ~</td>
- </tr>
-
- <tr ID="data1" colspan"2">
- <td class="window1" align="center">
-
- {additional_info}
-
- </td>
- </tr>
- </table>
I edited that from the code above and i got it a little bit closer, but now I get this:
Seems as if the cell doesnt span over enough, but I have tried to fix it and yet nothing helps that, I want to get that fixed before I edit the JS file and it ends up making things worse | |
|
Dreg[Bot] Moderator
Broken Posts: 415 Status: Offline Gender: Male Age: 37 Joined:
Additional Groups: Coding Team
pmYesh im sneaky! | Re: Toggle Effect {Help Plz} (29th Nov 08 at 1:29am UTC) | | havnt tested this but try
GLOBAL hEADDER
Code: - <style>
- .mp_hide {
- display:none;
- }
- </style>
-
-
- <script>
- function moo(s){
- if(s.parentNode.nextSibling.className == 'mp_show'){
- s.parentNode.nextSibling.className = 'mp_hide'
- } else {
- s.parentNode.nextSibling.className = 'mp_show';
- }
- }
- </script>
-
-
MP template
Code: - <table width="115" border="1" cellpadding="0" cellspacing="0">
- <tbody>
- <tr>
- <th onclick="moo(this);">~ Forum Data ~</th>
- </tr>
- <tr class='mp_show'>
- <td class="window1" id="data1" align="center">
- Level: 8.3
- <br>Money: 438
- <br>Jobs Done: 0
- <br>Contests Won: 0</td>
- </tr>
- </tbody>
- </table>
-
-
eidt: just to stop strethcing ^^ | |
Now obsession rules my mind This commotion makes me blind Searching out who ever runs Or has stolen away my life
But i've already said
Don't ever back down Don't ever turn around My end has come So now I come for you.... |
|
dog199200 Guest | Re: Toggle Effect {Help Plz} (29th Nov 08 at 1:49am UTC) | | It works, and I recognize that code, quick and simple, dont wnat to code it so revert to proboards and convert right Well thank you | |
|
Dreg[Bot] Moderator
Broken Posts: 415 Status: Offline Gender: Male Age: 37 Joined:
Additional Groups: Coding Team
pmYesh im sneaky! | Re: [F] Toggle Effect {Help Plz} [F] (29th Nov 08 at 3:35am UTC) | | ermm...no its not from PB, i just wrote it up in while on firebug on your forum. there was no such code its just common JS knowledge ^^
Notice i just used moo() | |
Now obsession rules my mind This commotion makes me blind Searching out who ever runs Or has stolen away my life
But i've already said
Don't ever back down Don't ever turn around My end has come So now I come for you.... |
|
dog199200 Guest | Re: [F] Toggle Effect {Help Plz} [F] (29th Nov 08 at 5:02am UTC) | | i've seen this before:
# if(s.parentNode.nextSibling.className == 'mp_show'){ # s.parentNode.nextSibling.className = 'mp_hide' } else { s.parentNode.nextSibling.className = 'mp_show'; # }
I just don't know where, maybe something you could of coded for proboards, possibly your mini-profile background mod | |
|
Dreg[Bot] Moderator
Broken Posts: 415 Status: Offline Gender: Male Age: 37 Joined:
Additional Groups: Coding Team
pmYesh im sneaky! | Re: [F] Toggle Effect {Help Plz} [F] (29th Nov 08 at 10:46am UTC) | | must be just the name mp_hide and mp_show or something its the way i name Miniprofile classes XD | |
Now obsession rules my mind This commotion makes me blind Searching out who ever runs Or has stolen away my life
But i've already said
Don't ever back down Don't ever turn around My end has come So now I come for you.... |
|