If anyone could send a code for adding a toggle button on the forum desciption like ere that would be awesome. I'm talking about the toggle above the hexagonal Forumotion icon.
3 posters
Toggle Button in Description
Take Notes- Helper
- Posts : 2337
Reputation : 324
Language : English
Location : Forumountain
- Post n°1
Toggle Button in Description
SLGray- Administrator
- Posts : 51498
Reputation : 3523
Language : English
Location : United States
- Post n°2
Re: Toggle Button in Description
Do you mean the category toggler?
Lost Founder's Password |Forum's Utilities |Report a Forum |General Rules |FAQ |Tricks & Tips
You need one post to send a PM.
You need one post to send a PM.
When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
Take Notes- Helper
- Posts : 2337
Reputation : 324
Language : English
Location : Forumountain
- Post n°3
Re: Toggle Button in Description
Not that one, the one above it that doesn't look as good. The box one with the minus symbol.
SLGray- Administrator
- Posts : 51498
Reputation : 3523
Language : English
Location : United States
- Post n°4
Re: Toggle Button in Description
Could you post a screenshot?
Lost Founder's Password |Forum's Utilities |Report a Forum |General Rules |FAQ |Tricks & Tips
You need one post to send a PM.
You need one post to send a PM.
When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
Ange Tuteur- Forumaster
- Posts : 13207
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania
- Post n°5
Re: Toggle Button in Description
@Genesis here's a very basic example code :
I've added comments to explain the code, but if you need any help let me know.
- Code:
<!-- STYLES FOR THE BUTTON AND CONTENT -->
<style type="text/css">
#toggle-button {
/* button style here */
}
#toggle-content {
/* content style here */
}
</style>
<!-- TOGGLE BUTTON AND CONTENT -->
<a id="toggle-button" href="#">Hide</a>
<div id="toggle-content">CONTENT HERE</div>
<!-- JAVASCRIPT FOR TOGGLE LOGIC -->
<script type="text/javascript">(function() {
// get the button and content
var button = document.getElementById('toggle-button'),
content = document.getElementById('toggle-content');
// check if the content has been hidden
if (my_getcookie('toggle_content') == 'hidden') {
content.style.display = 'none';
button.innerHTML = 'Show';
}
// make the button do something when it's clicked
button.onclick = function() {
var content = document.getElementById('toggle-content'); // get the content again, but locally inside this function
// if the content has been hidden we'll show it, otherwise we'll hide it
if (/none/.test(content.style.display)) {
content.style.display = '';
this.innerHTML = 'Hide';
my_setcookie('toggle_content', 'shown');
} else {
content.style.display = 'none';
this.innerHTML = 'Show';
my_setcookie('toggle_content', 'hidden');
}
return false; // prevents the button from opening the HREF content
};
}());</script>
I've added comments to explain the code, but if you need any help let me know.
Take Notes- Helper
- Posts : 2337
Reputation : 324
Language : English
Location : Forumountain
- Post n°6
Re: Toggle Button in Description
Thank you @Ange Tuteur!
Is there a way to make the toggle look like the category toggle on this forum?
Is there a way to make the toggle look like the category toggle on this forum?
Ange Tuteur- Forumaster
- Posts : 13207
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania
- Post n°7
Re: Toggle Button in Description
Replace all instances of "Hide" and "Show" with whatever you want. It can be text ( +, -.. ), an image ( <img src="..."/> ), etc.. Then edit the stylesheet at the top to change the button or content styles :
- Code:
<style type="text/css">
#toggle-button {
/* button style here */
}
#toggle-content {
/* content style here */
}
</style>
Take Notes- Helper
- Posts : 2337
Reputation : 324
Language : English
Location : Forumountain
- Post n°8
Re: Toggle Button in Description
Solved! Thank you once again "Ange Tuteur"!
SLGray- Administrator
- Posts : 51498
Reputation : 3523
Language : English
Location : United States
- Post n°9
Re: Toggle Button in Description
Topic solved and archived
Lost Founder's Password |Forum's Utilities |Report a Forum |General Rules |FAQ |Tricks & Tips
You need one post to send a PM.
You need one post to send a PM.
When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.