The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Cant get toggle to work

4 posters

Go down

Solved Cant get toggle to work

Post by Ape October 23rd 2011, 9:06 pm

Hi all
i have been trying to get this to work but can't
https://help.forumotion.com/t96460-category-toggle-script
i have done as it said and still cant get it to work Sad
can some one help me please

My code i have is
Code:
<script type="text/javascript">
    function toggleLTcategory(cat) {
        var cid=cat.id;
        var button=document.getElementById('b'+cid);
        if (cat.style.display=='none') {
            cat.style.display='block';
            button.className='contract';
            my_setcookie('_' + cid, '', true);
        }
        else {
            cat.style.display='none';
            button.className='expand';
            my_setcookie('_' + cid, '1', true);
        }
    }

    jQuery(function () {
        x=jQuery('.topiclist .header').get();
        for (i=0; i<x.length; i++) {
            x[i].style.position='relative';
            var cid='c'+String(i+1);
            x[i].parentNode.nextSibling.setAttribute('id',cid);
            x[i].parentNode.nextSibling.style.display='block';
            var y='<div id="b'+cid+'" class="contract" onclick="toggleLTcategory(this.parentNode.parentNode.nextSibling);"></div>';
            x[i].innerHTML=x[i].innerHTML+y;
        }

cookies = document (.) cookie.split('; ');
        for (i in cookies) {
            if (cookies[i].charAt(0) == '_') {
                cookie = cookies[i].split('=');
                if (cookie[1] == '1') {
                    cid = cookie[0].substring(1);
                    if (document.getElementById(cid)) {toggleLTcategory(cid);}
                }
            }
        }
    });
    </script>

Ape Neutral


Last edited by ape man on October 26th 2011, 4:42 pm; edited 1 time in total
Ape
Ape
Administrator
Administrator

Male Posts : 19432
Reputation : 2010
Language : fluent in dork / mumbojumbo & English haha

http://chatworld.forumotion.co.uk/

Back to top Go down

Solved Re: Cant get toggle to work

Post by YoshiGM October 26th 2011, 12:09 am

Have you added the CSS Code after you pasted the Java ?
YoshiGM
YoshiGM
Active Poster

Male Posts : 1562
Reputation : 146
Language : Spanish & English
Location : Mexico

http://asistencia.foroactivo.com/u21373

Back to top Go down

Solved Re: Cant get toggle to work

Post by Base October 26th 2011, 10:44 am

Hi!

Have you followed the other steps correctly? Please also note that this tutorial does not support forums running on version phpBB 2. Smile
Base
Base
Forumaster

Male Posts : 10383
Reputation : 1695
Language : English and French
Location : United Kingdom, England

http://forumotionhub.net

Back to top Go down

Solved Re: Cant get toggle to work

Post by Guest October 26th 2011, 11:34 am

Add in the description of the last forum Smile Exemple: Trash / Garbage
avatar
Guest
Guest


Back to top Go down

Solved Re: Cant get toggle to work

Post by Ape October 26th 2011, 4:35 pm

ok i have worked it out i have played about with some things and got it working thank you guys
Ape
Ape
Administrator
Administrator

Male Posts : 19432
Reputation : 2010
Language : fluent in dork / mumbojumbo & English haha

http://chatworld.forumotion.co.uk/

Back to top Go down

Solved Re: Cant get toggle to work

Post by Nera. October 26th 2011, 4:43 pm

Lock
Nera.
Nera.
Energetic

Female Posts : 7078
Reputation : 2017
Language : English
Location : -

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum