I created a similar effect for Elementor, but had issues doing the same for BB. wpbeaverworld was kind enough to show me how to do the same thing on BB. Here are the code snippets for implementing this custom functionality.
Add a row and configure its settings as follows:
ID: [Enter ID to identify the row]
Class: toggle-section
Note: The name of the class can be something else.
Add a button above the row and configure its settings as follows:
Text: [Enter Name of Button]
Link: JavaScript:void(0);
Class: toggle-button
Note: The name of the class can be something else.
Add the following JavaScript code to the Layout CSS & Javascript > JavaScript pane:
Is there a way to adapt this for multiple buttons/rows?
I have a case where i want to have 3 buttons, each one will display a different form when clicked (and obviously hide any other form showing in the process). I have been using this code and trying to modify it but with no success, as my skills in javascript are quite limited
At most simpler, you could put your different forms each in a tab of a Tab module and use the buttons to open the proper tab:
• Add an ID to the Tabs module; e.g. my-tab
• Target the tabs with a link on the button like #my-tab-0, #my-tab-1…
Or the JS way, which would require to add an attribute to the buttons to target the columns.
This little BB 3rd party plugin adds the attribute support to modules: https://github.com/JasonTheAdams/BBCustomAttributes
Sorry, I think I commented under the wrong post. I added what @Mars shared and I know there is both a JS and CSS way to add animation. My problem is I have not been able to do it right.
SlideDown works, but I am stuck on making a Slideup effect work when hiding the section again.
The js doesn’t seem to be working anymore with the latest version of BB. Plus it’s breaking the UI when trying to click over to the JavaScript pane. (had to activate safemode in order to go back to the tab and remove it)
Hi
I found this thread as I am trying to show/hide multiple rows with different buttons on the same page, similar to MattS’ question.
The suggestion of Tabs or accordion does not work with the layout.
The design has 8 sections made up of one row with a button and the hidden row below it.
Is there a way to have one jQuery/CSS script that can apply to all the buttons or do I need to have separate scripts for each button? I saw one solution using jQuery(this).next() but it didn’t work for me. I am not a developer, so I may have been doing it wrong.
Hello! I can’t get this to work for a main menu. Would that be different?
I’m trying to create a menu like the one at this website when you click on “books”:
The menu link reveals the hidden row.
But you can’t enter a link: JavaScript:void(0);
for a menu item.
Hi Chris,
I have used your script for toggling a row. Works fine … thanks. But what about columns? Please have a look to this post
and click on the shop icon. This opens the toggled section for a moment, but then it disappears and the whole page seems to be reloaded. Any idea how to fix that issue?
Yes, Before I was adding javascript:void(0) to the href link, but that is no longer an accepted method, so I just add a # and then add e.preventDefault(); to the JS as Pross mentioned.