~~~ Please read before posting. ~~~

Important: We need your Club Number at a minimum, and as many details as possible.
For further info please read This page before posting.

Best way to create an accordion dropdown

  • _queen_beans
  • _queen_beans's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 4
  • Thanks: 0

Best way to create an accordion dropdown

5 years 4 months ago
#80734
My team would like to implement an accordion dropdown on one of our pages, as it's addresses the problem of seamlessly displaying many categorized ordered lists.

Here's a sample of the desired outcome, implemented in codepen.io
Sample in Codepen.io


I understand there are risks with utilizing js and the admins of this platform are generally not happy when people use them. Mine is vanilla js and not external, however. I'd like to work with the creators of FTH and not get my website frozen/ wiped. Here's a snipped of the code I'd like to use.
Code:
var acc = document.getElementsByClassName("accordion"); var i; for (i = 0; i < acc.length; i++) { acc[i].addEventListener("click", function() { this.classList.toggle("active"); this; var panel = this.nextElementSibling; if (panel.style.display === "block") { panel.style.display = "none"; this.style["background-color"] = "#004165"; } else { panel.style.display = "block"; this.style["background-color"] = "rgb(119, 36, 50)"; } }); }
The topic has been locked.
  • Brian
  • Brian's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 10958
  • Thanks: 3648

Re: Best way to create an accordion dropdown

5 years 4 months ago
#80736
FTH does not support any 3rd party scripts. If your script breaks anything we will clear the page.
Please read the Terms of use.
support.toastmastersclubs.org/doc/item/terms-of-use-agreement
Thank you,

Brian McDonald DTM
Silver and Wiser Online Toastmasters Club #777940

Technical Support Consultant for FreeToastHost
The topic has been locked.
  • Pam
  • Pam's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 3855
  • Thanks: 1056

Re: Best way to create an accordion dropdown

5 years 4 months ago - 5 years 4 months ago
#80738
Refer to this post for creating accordions in FTH
support.toastmastersclubs.org/2011-10-23...dion-in-your-content
FreeToastHost Ambassador
VPE HOT Toastmasters 2025-2026 hot.toastmastersclubs.org/
Webmaster Redlands Toastmasters 2025-2026 redlands.toastmastersclubs.org/
Last edit: 5 years 4 months ago by Pam.
The topic has been locked.
  • _queen_beans
  • _queen_beans's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 4
  • Thanks: 0

Re: Best way to create an accordion dropdown

5 years 4 months ago
#80739
Any comment on this response?

The topic has been locked.
  • SteveTheTechie
  • SteveTheTechie's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 11526
  • Thanks: 3050

Re: Best way to create an accordion dropdown

5 years 4 months ago - 5 years 4 months ago
#80740
So you pulled one of my posts from over 5 years ago... :pinch: :thumbsdn:

The fundamental problem is that you may move on from Toastmasters and then your current club is stuck with maintaining whatever you implemented. They will then likely come to us and ask us to help them update your code. We really do not want to be in the position of having to teach people how to do Javascript correctly (not our purpose) or having to fix some problem that somebody else created because they did not heed our warnings. We are volunteers giving up a bit of our little spare time.

In your case, class names "accordion" and "active" will sooner or later end up clashing w/ our code. Only good work around is prefixing them with your club number.
Last edit: 5 years 4 months ago by SteveTheTechie.
The topic has been locked.
  • _queen_beans
  • _queen_beans's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 4
  • Thanks: 0

Re: Best way to create an accordion dropdown

5 years 4 months ago - 5 years 4 months ago
#80741
To be fair, the thread with the official, endorsed accordion solution is also over 5 years old. I'm just working with whatever information I can gather. But I'll stick with the linked solution as I really don't want to pull teeth over this. Thanks for all your help.
Last edit: 5 years 4 months ago by _queen_beans.
The topic has been locked.
Moderators: BrianPamrhtaylor3marc33NotLiableNSBjgavinHeniLcala305peterb323DebbieT
Time to create page: 0.526 seconds