I’ve been trying for hours but can’t seem to have an interaction where an open drop-down is closed when a closed one is opened (not a Webflow drop-down element. It’s made from divs - more like an accordion) . They are different FAQs.
I can’t use Webflows’ drop-down because the text is too long to be contained and cuts off the screen in a straight line. I even tried wrapping text with a div but to no avail. Seems like the drop-down wasn’t made to hold short paragraphs.
Currently, it’s set up with a first and second click interaction which means you’ll have to click the trigger again to make it close. I tried interactions 1.0 but unfortunately you can’t affect neccessary elements (ie…font color and other css styles) like you can with interactions 2.0.
I came across this one as well but the problem is that you can’t change the text color on the one that is opened since it was created with legacy interactions.
the class .toggle-left-wrap is the class I named that wraps the heading of the FAQ item. The class .w--open is the class that gets added via javascript for the open state.
That works but the other issue is that you can’t have long sentences as dropdown titles. On mobile, the text doesn’t wrap in the dropdown, it just keeps going. For example, if I had a title that was as long as “What is the cost saving & business advantage that my company can gain from visiting your shop and not going to another shop?” (just a random title) or longer, it doesn’t wrap. If your example was made from all divs instead, it would be perfect.
You just need to add some custom CSS to the wrapper of the content inside the dropdown.
.class-name { white-space: initial; }
You can also just use the default Webflow dropdown element. If your dropdowns are stacked, you’ll need to change the dropdown content wrapper to position relative so it pushes the other dropdowns down when you open a dropdown.
See screen recording. I inspected element and added the above code the div which contains the sentence. The screen recording doesn’t show the inspect elements window.