I am trying to build a dropdown using divs and interactions because the dropdown element doesn’t wrap text on long lines on mobile.
I want it to function like a dropdown element does:
- The “open” state of the toggle is different from the “closed” state.
- Opening a dropdown closes any other dropdowns that were opened previously.
Like this: http://chapmaninvestment.com/investment-philosophy.html
I have come close to achieving this with interactions, but the interactions are now overlapping each other in a way that messes up functionality:
- I achieved this by making the “open” state an absolute positioned div that is set to Display: None, with an interaction that displays it upon clicking the “Accordion Toggle Holders” div, and hides it on second click.
- I used interactions to close any already-opened dropdowns when you click a closed dropdown.
Here’s where the issue happens: You click “Dropdown One” to open it. The “open” state displays when you open it. You leave it open and click “Dropdown Two”. When “Dropdown Two” opens, it closes “Dropdown One,” and hides the “open” state of “Dropdown One.” All good so far. But then if you want to open “Dropdown One” again, nothing seems to be happening - because the second click on “Dropdown One” is hiding the “open” state, which has already been hidden by opening “Dropdown Two.”
Apologies for the confusing explanation… please have a look at my read-only link to see what I mean.
I’d love any ideas on how to achieve this!
Thanks!
Here is my site Read-Only: LINK
([how to share your site Read-Only link][2])