Toggle Button in Description
3 posters
Page 1 of 1
Toggle Button in Description
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.
Take Notes- Helper
-
Posts : 2337
Reputation : 324
Language : English
Location : Forumountain
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.
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.
Take Notes- Helper
-
Posts : 2337
Reputation : 324
Language : English
Location : Forumountain
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.
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.

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?
Take Notes- Helper
-
Posts : 2337
Reputation : 324
Language : English
Location : Forumountain
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>
Re: Toggle Button in Description
Solved! Thank you once again "Ange Tuteur"!
Take Notes- Helper
-
Posts : 2337
Reputation : 324
Language : English
Location : Forumountain
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.

» Toggle button overlap category
» how can I make a profile toggle button
» Where to Change Category Toggle Button
» How can I add on Toggle Button Javascript slideup/slidedown?
» Graphic Request: Small Button for Widget Toggle
» how can I make a profile toggle button
» Where to Change Category Toggle Button
» How can I add on Toggle Button Javascript slideup/slidedown?
» Graphic Request: Small Button for Widget Toggle
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum