I’m trying to get one of the dropdowns to open automatically when the page loads (so they’re not all collapsed). I’ve looked at tons of threads here on this topic, but none of them seem to work anymore.
I’ve tried this code, but it doesn’t seem to work…
Any ideas on how to get this functionality?
Solution note: The solution below works! Just make sure not to have an animation that includes an “initial-state”
Caveat: Since the dropdown is open by default then closing it for the first time takes two clicks. Because I haven’t overwritten the default Webflow’s interaction to open it on the first click and then close it on the second click.
How to use:
Paste this code in the body tag.
You need to replace w-dropdown-list-1 with an ID of the dropdown list you want to show by default. Do you know how to use Dev Tools to locate the ID? If not. Then add a custom ID manually within Webflow to the Dropdown List (the one nested within the parent Dropdown) element:
and use that ID in the code instead of w-dropdown-list-1.
I’ve tried this on the default dropdown and it works. But your specific case might have some other requirements that might not work with this. Let me know if that’s the case.
Note, test the code on the published version. It won’t run in preview mode or the designer.
THANK YOU! I had to restore my webflow forum password just to express my gratitude. I can’t believe this is working PERFECTLY! I’ve spent HOURS of research and published my website hundreds of time and it was all in vain. It’s crazy how webflow can’t add such a simple setting for their dropdown elements since 2017! All the best to you!
Hi Max, I know this is an old topic, but is the only solution that I found, but for me is not working?
Any idea? My drow downs already have the correct id: w-dropdown-toggle-0, w-dropdown-toggle-1, w-dropdown-toggle-2 etc
I am using the custom dropdown with interactions…
thanks so much!
Non of the solutions in this post works in 2023 (Webflow maybe change the core code). Also to add mannualy classes like w--open will not work (On the first click the dropdown will not toggle normally).
The solution should be some Basic API of webflow for ideas like this.