You’re trying to create a sliding effect for a div triggered by a button click in Webflow. The first two buttons already work, so you likely have some interactions or jQuery/jQuery-style code running—but additional buttons aren’t behaving as expected.
Here's how you can implement this fully in Webflow’s native interactions system without needing jQuery.
- Place your sliding div (e.g., a panel, sidebar, tab, etc.) in the element structure.
- Name the div clearly (e.g.,
slide-panel-1
, slide-panel-2
, etc.) for each individual sliding section. - Add unique IDs or classes to your remaining buttons (e.g.,
btn-slide-3
, btn-slide-4
, etc.).
2. Create the Sliding Animation
- In Webflow, go to the Interactions (lightning icon) panel.
- Click Page Trigger > On Click (Mouse Click) > Element Trigger.
- Choose one of the working buttons to review the existing interaction (likely using "Move" or "Size" properties).
- Clone this interaction, and apply it to Button 3, Button 4, and Button 5.
- Just make sure to target the correct div (e.g.,
slide-panel-3
, slide-panel-4
, etc.) in the cloned interaction.
3. Adjust Movement Values
- In each cloned interaction, set the Move X or Y (depending on direction) value so that sliding is consistent (e.g., Move X = 100% or -100%).
- Be sure to create both Hide and Show animations (or toggled visibility if needed).
- Use easing like ease-in-out and set the duration (e.g., 0.4s) for smooth movement.
4. Optional: Use Webflow’s Tabs Component
- If the use case requires multiple panels swapping in and out, consider using Webflow’s Tabs component and then styling each Tab Pane to slide into view using interactions.
- This avoids manually mapping each button to a custom animation.
5. Need for Custom jQuery (Only if Absolutely Necessary)
If you're already using jQuery (and want to stick with that approach), make sure:
- Each button has a unique ID and
- Your jQuery
.click()
handlers also reference the correct panel or div (e.g., $('#btn-3').click(() => $('#panel-3').slideToggle());
). - All jQuery must be inside Webflow’s Page Settings > Footer Custom Code or wrapped in
$(document).ready()
if used via Webflow's Embed component.
Summary
You can build the sliding effect for additional buttons using Webflow’s native interactions by cloning and editing the animations from your first two buttons. Be sure to match each button to the correct panel and confirm each has a unique identifier. Only use jQuery if there's a specific reason you can't implement it natively in Webflow.