Category toggle Script do not work..

Go down

Category toggle Script do not work..

Post by Marvin on November 29th 2011, 5:11 pm

Hello, this script do not work on my Forum.. I have an phpbb3 Forum an placed that in my Homepagy in the General.
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>
an this in the css:
Code:
        .expand, .contract {position: absolute; top: 6px; right: 10px; cursor: pointer; width: 9px; height: 9px; background: url(http://illiweb.com/fa/m/tabs_more1.gif);}
        .contract {background: url(http://illiweb.com/fa/m/tabs_less1.gif);}
My Forum: http://www.schiggysboard.com/

But it doesn't work..
avatar
Marvin
Forumember

Male Posts : 317
Reputation : 4
Language : German, basic English, Spanish, basic Bavarian, broken Italian

http://www.schiggysboard.com/

Back to top Go down

Re: Category toggle Script do not work..

Post by Guest on November 29th 2011, 5:17 pm

I'm not sure, but try to add this code:
Code:
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);}
            }
        }
    }
});
in JavaScript management. Modules => HTML & JAVASCRIPT => Javascript codes management => Javascript Codes => Enable Javascript code management : Yes; Click Create a new javascript button. Take sure that Placement : is In the home page or better In all the pages. Wink

Guest
Guest


Back to top Go down

Re: Category toggle Script do not work..

Post by Marvin on November 29th 2011, 5:21 pm

no.. Confused
avatar
Marvin
Forumember

Male Posts : 317
Reputation : 4
Language : German, basic English, Spanish, basic Bavarian, broken Italian

http://www.schiggysboard.com/

Back to top Go down

Re: Category toggle Script do not work..

Post by Omu on November 29th 2011, 9:02 pm

Try this:
ACP > Modules > Javascript codes management:

Code:
        jQuery(function() {
          jQuery('div.forabg ul li.header').prepend('<span class="toggle" style="float: right; margin-right: 10px; font-weight: bold; margin-top: 5px; cursor: pointer;"><img src="http://icons.iconarchive.com/icons/iconarchive/red-orb-alphabet/16/Math-minus-icon.png" width="10px" /></span>');
 
          jQuery('.toggle').click(function() {
            if (jQuery(this).parent().parent().parent().find('li.row').is(':visible')) {
              jQuery(this).html('<img src="http://icons.iconarchive.com/icons/custom-icon-design/office/16/add-1-icon.png" width="10px" />');
              jQuery(this).parent().parent().parent().find('li.row').hide('slow');
            }
 
            else {
              jQuery(this).html('<img src="http://icons.iconarchive.com/icons/iconarchive/red-orb-alphabet/16/Math-minus-icon.png" width="10px" />');
              jQuery(this).parent().parent().parent().find('li.row').show('slow');
            }
          });
        });

or this:


ACP > Modules > Javascript codes management:

Code:
  var pvf= document.getElementById('main-content').firstChild; while(pvf.className!='forabg' && pvf.className!='h3' && (pvf=pvf.nextSibling) ); var i= 1; while(pvf && pvf.className=='forabg') { vf=pvf.firstChild.firstChild.nextSibling; vf.firstChild.style.cursor='pointer'; vf.firstChild.id='catret'+(i++); vf.firstChild.onclick=function() { if(parseInt(my_getcookie(this.id))==1) { my_setcookie(this.id,'0',0,0); this.parentNode.nextSibling.style.display='block'; } else { my_setcookie(this.id,'1',1,0); this.parentNode.nextSibling.style.display='none'; } }; if(parseInt(my_getcookie(vf.firstChild.id))==1) vf.nextSibling.style.display='none'; pvf= pvf.nextSibling; }
avatar
Omu
Active Poster

Male Posts : 1019
Reputation : 87
Language : Romanian, English, French
Location : Romania

http://supportdrops.com/

Back to top Go down

Re: Category toggle Script do not work..

Post by Marvin on November 29th 2011, 9:58 pm

Thank you, the first script is working.
The second not^^

Its solved.
avatar
Marvin
Forumember

Male Posts : 317
Reputation : 4
Language : German, basic English, Spanish, basic Bavarian, broken Italian

http://www.schiggysboard.com/

Back to top Go down

Re: Category toggle Script do not work..

Post by Omu on November 29th 2011, 10:01 pm

With pleasure Smile Glad to help you Very Happy
avatar
Omu
Active Poster

Male Posts : 1019
Reputation : 87
Language : Romanian, English, French
Location : Romania

http://supportdrops.com/

Back to top Go down

Re: Category toggle Script do not work..

Post by Marvin on November 29th 2011, 10:02 pm

But in the Internet Explorer it does'nt work?
Why?
avatar
Marvin
Forumember

Male Posts : 317
Reputation : 4
Language : German, basic English, Spanish, basic Bavarian, broken Italian

http://www.schiggysboard.com/

Back to top Go down

Re: Category toggle Script do not work..

Post by Omu on November 29th 2011, 10:04 pm

Probably beacause Internet Explorer is an old browser, and can't execute the javascript codes.


Last edited by Gyzmo on November 30th 2011, 7:12 am; edited 1 time in total
avatar
Omu
Active Poster

Male Posts : 1019
Reputation : 87
Language : Romanian, English, French
Location : Romania

http://supportdrops.com/

Back to top Go down

Re: Category toggle Script do not work..

Post by Marvin on November 29th 2011, 10:05 pm

Gyzmo wrote:Probably beacause Internet Explorer is an old browser, he can't execute the javascript codes.
But in the support forum work the script..
avatar
Marvin
Forumember

Male Posts : 317
Reputation : 4
Language : German, basic English, Spanish, basic Bavarian, broken Italian

http://www.schiggysboard.com/

Back to top Go down

Re: Category toggle Script do not work..

Post by Omu on November 29th 2011, 10:08 pm

Go to javascript codes management:

ACP > Modules > Javascript codes management:

Code:
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);}
            }
        }
    }
});
avatar
Omu
Active Poster

Male Posts : 1019
Reputation : 87
Language : Romanian, English, French
Location : Romania

http://supportdrops.com/

Back to top Go down

Re: Category toggle Script do not work..

Post by Marvin on November 29th 2011, 10:12 pm

and if I reload the page, the theme again popped up.In the support forum that is different
avatar
Marvin
Forumember

Male Posts : 317
Reputation : 4
Language : German, basic English, Spanish, basic Bavarian, broken Italian

http://www.schiggysboard.com/

Back to top Go down

Re: Category toggle Script do not work..

Post by Omu on November 29th 2011, 10:14 pm

Use the first code pasted by me. Sorry but I don't know how to make it for IE Sad
avatar
Omu
Active Poster

Male Posts : 1019
Reputation : 87
Language : Romanian, English, French
Location : Romania

http://supportdrops.com/

Back to top Go down

Re: Category toggle Script do not work..

Post by Marvin on November 29th 2011, 10:17 pm

Hm.. but I will have it in the Internet Explorer same..
and if I reload the page to the forums remain folded

..can you say me, why the "normal" code from here: help.forumotion.com/t96460-category-toggle-script

doesnt work in my forum?
avatar
Marvin
Forumember

Male Posts : 317
Reputation : 4
Language : German, basic English, Spanish, basic Bavarian, broken Italian

http://www.schiggysboard.com/

Back to top Go down

Re: Category toggle Script do not work..

Post by Omu on November 29th 2011, 10:18 pm

You have the CSS code?
Code:

        .expand, .contract {position: absolute; top: 6px; right: 10px; cursor: pointer; width: 9px; height: 9px; background: url(http://illiweb.com/fa/m/tabs_more1.gif);}
        .contract {background: url(http://illiweb.com/fa/m/tabs_less1.gif);}
avatar
Omu
Active Poster

Male Posts : 1019
Reputation : 87
Language : Romanian, English, French
Location : Romania

http://supportdrops.com/

Back to top Go down

Re: Category toggle Script do not work..

Post by Marvin on November 29th 2011, 10:18 pm

Yes..
I fill in both now, twice.
avatar
Marvin
Forumember

Male Posts : 317
Reputation : 4
Language : German, basic English, Spanish, basic Bavarian, broken Italian

http://www.schiggysboard.com/

Back to top Go down

Re: Category toggle Script do not work..

Post by blindbat1457 on November 30th 2011, 12:15 am

Gyzmo wrote:Probably beacause Internet Explorer is an old browser, he can't execute the javascript codes.

Whoa you learn something new every day. I never knew IE was a male.
avatar
blindbat1457
Forumember

Male Posts : 667
Reputation : 6
Language : English
Location : Santa Clarita, CA

Back to top Go down

Re: Category toggle Script do not work..

Post by Omu on November 30th 2011, 7:14 am

Post with no reason...If you don't want to give some help at users, please, don't post.
avatar
Omu
Active Poster

Male Posts : 1019
Reputation : 87
Language : Romanian, English, French
Location : Romania

http://supportdrops.com/

Back to top Go down

Re: Category toggle Script do not work..

Post by Base on November 30th 2011, 4:36 pm

Gyzmo; please don't moderate other users and please take any off-topic discussions to PM, thanks. Smile

Is this problem solved?
avatar
Base
Forumaster

Male Posts : 10386
Reputation : 1693
Language : English and French
Location : United Kingdom, England

http://forumotionhub.net

Back to top Go down

Re: Category toggle Script do not work..

Post by Marvin on November 30th 2011, 9:23 pm

@Base wrote:
Is this problem solved?
No.. it shows not in the Internet Explorer.
avatar
Marvin
Forumember

Male Posts : 317
Reputation : 4
Language : German, basic English, Spanish, basic Bavarian, broken Italian

http://www.schiggysboard.com/

Back to top Go down

Re: Category toggle Script do not work..

Post by probidthetalk on November 30th 2011, 10:14 pm

Friend what IE version are you using? If you are version 7 and lower it wont appear correctly
avatar
probidthetalk
Forumember

Posts : 139
Reputation : 3
Language : PHP/MYSQL/HTML

Back to top Go down

Re: Category toggle Script do not work..

Post by Marvin on November 30th 2011, 10:28 pm

I use Internet Explorer 9.

In the Support Forum work the script. I need the script, that the Support Forum use.
avatar
Marvin
Forumember

Male Posts : 317
Reputation : 4
Language : German, basic English, Spanish, basic Bavarian, broken Italian

http://www.schiggysboard.com/

Back to top Go down

Re: Category toggle Script do not work..

Post by Marvin on December 1st 2011, 6:23 pm

push
avatar
Marvin
Forumember

Male Posts : 317
Reputation : 4
Language : German, basic English, Spanish, basic Bavarian, broken Italian

http://www.schiggysboard.com/

Back to top Go down

Re: Category toggle Script do not work..

Post by MrMario on December 1st 2011, 7:29 pm

Hello,

This tutorial no longer exist on this board as per request of the creator.
avatar
MrMario
Helper
Helper

Male Posts : 22186
Reputation : 1837
Language : test

http://test.com

Back to top Go down

Re: Category toggle Script do not work..

Post by Marvin on December 2nd 2011, 6:50 pm

but the script is set on this forum.. an it works without errors.. can you give my the code?
avatar
Marvin
Forumember

Male Posts : 317
Reputation : 4
Language : German, basic English, Spanish, basic Bavarian, broken Italian

http://www.schiggysboard.com/

Back to top Go down

Back to top


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