The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

Toggle Widgets + Toggle Categories

View previous topic View next topic Go down

Solved Toggle Widgets + Toggle Categories

Post by EEYEN3 on October 15th 2015, 3:05 pm

Technical Details


Forum version : #phpBB2
Position : Founder
Concerned browser(s) : Opera
Who the problem concerns : Yourself
Forum link : testforumxwa.forumotion.com

Description of problem

Found this old thread http://help.forumotion.com/t128240-expand-collapse-toggle-widgets

I want the same thing that person wanted, to be able to toggle widgets individually. For whatever reason, that's not working for me. I have the collapse all tutorial code activated as well. Could that be my problem?

I don't know anything about javascript so please dumb down all answers. Thank you.

Thanks for any reply.

EDIT: I've just checked the toggle categories javascript and that doesn't show up for normal members. It does show up for admins, though. The toggle widgets code just doesn't show up at all.


Last edited by SLGray on October 16th 2015, 6:15 am; edited 3 times in total

EEYEN3
Forumember

Posts : 80
Reputation : 1
Language : English

Back to top Go down

Solved Re: Toggle Widgets + Toggle Categories

Post by Ange Tuteur on October 15th 2015, 6:37 pm

Hi @EEYEN3,

From what I can tell, the script appears working. You just need a bit of CSS which will help contain the button. Add this to your stylesheet :
Code:
.forumline { position:relative; }

Ange Tuteur
Forumaster

Male Posts : 13021
Reputation : 2683
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: Toggle Widgets + Toggle Categories

Post by EEYEN3 on October 15th 2015, 8:00 pm

Thanks! Can you help me with the category toggle also? It works for my admin account but not for my normal user account.

EEYEN3
Forumember

Posts : 80
Reputation : 1
Language : English

Back to top Go down

Solved Re: Toggle Widgets + Toggle Categories

Post by Ange Tuteur on October 15th 2015, 9:52 pm

Hmm.. I'm not sure why that would be unless you have a script that's only executed for member's which is throwing an error. Just to make sure, you added the following script with placement in the homepage, correct ?
Code:
$(function(){
        $('#content-container .secondarytitle').parent().append('<span class="toggles"><img src="http://i57.servimg.com/u/f57/18/10/12/74/cat_mi10.png"/></span>');
        var heads = $('#content-container .secondarytitle').parent();
        for(var i=0;i<heads.length;i++){
        $(heads[i]).attr({
        id:'cat'+i,
        class: 'parent'
        });
        }
        var cookie = ReadCookie('catTog').split(',');
        for(var j=0;j<cookie.length;j++){
        $(cookie[j]).nextAll('tr').css('display','none');
        $(cookie[j]).find('.toggles').children('img').attr('src','http://i57.servimg.com/u/f57/18/10/12/74/cat_ma10.png');
        }
        $('.toggles').on('click',function() {
        var g = $(this).closest('.parent').nextAll('tr').css('display');
        cookieList = ReadCookie('catTog');
        if(g == "table-row") {
        var cid= $(this).closest('.parent').attr('id');
        $(this).closest('.parent').nextAll('tr').hide();
        SetCookie("catTog",cookieList+",#"+cid,1000);
        $(this).children('img').attr('src','http://i57.servimg.com/u/f57/18/10/12/74/cat_ma10.png');
        } else {
        KillCookie("catTog");
        var newCookie=[],
        a= $('.parent').nextAll('tr').filter(":hidden"),
        c = $.map(a,function(n,i){
        return "#"+$(a).closest('.parent').attr('id');
        });
        newCookie= c.join(',');
            SetCookie('catTog',newCookie, 100);
        $(this).children('img').attr('src','http://i57.servimg.com/u/f57/18/10/12/74/cat_mi10.png').parent().parent().parent().children('tr').not(":eq(0)").show();
        }
        });
        });
        function SetCookie(cookieName,cookieValue,nDays) {
        var today = new Date();
        var expire = new Date();
        if (nDays===null || nDays===0) nDays=1;
        expire.setTime(today.getTime() + 3600000*24*nDays);
        document.cookie = cookieName+"="+escape(cookieValue)+ ";expires="+expire.toGMTString();
        }
        function ReadCookie(cookieName) {
        var theCookie=""+document.cookie;
        var ind=theCookie.indexOf(cookieName+"=");
        if (ind===-1 || cookieName==="") return "";
        var ind1=theCookie.indexOf(";",ind);
        if (ind1==-1) ind1=theCookie.length;
        return unescape(theCookie.substring(ind+cookieName.length+1,ind1));
        }
        function KillCookie(cookieName){SetCookie(cookieName,"",-1);}

You'll most likely need a bit of CSS too :
Code:
.toggles {
  position:absolute;
  right:10px;
  top:5px;
}

Ange Tuteur
Forumaster

Male Posts : 13021
Reputation : 2683
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: Toggle Widgets + Toggle Categories

Post by EEYEN3 on October 16th 2015, 5:34 am

Thank you! Both problems fixed.

This topic is solved.

EEYEN3
Forumember

Posts : 80
Reputation : 1
Language : English

Back to top Go down

Solved Re: Toggle Widgets + Toggle Categories

Post by SLGray on October 16th 2015, 6:14 am

Topic solved and archived


When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.


SLGray
Administrator
Administrator

Male Posts : 35628
Reputation : 2372
Language : English
Location : United States

http://fmthemes.forumotion.com/

Back to top Go down

View previous topic View next topic Back to top


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