Does anyone know if it's possible to create an expandable/collapsible section in a popup in Map Viewer? In my popup I have a 'facilities' section which I would like to display as hidden when the popup loads, but give the option to the user to expand the section if they wish.
My popup currently looks like this:
But what I'd like is for the Facilities selection to load collapsed with an option/button the user can click to expand, something like this:
I can add style='display:none;' to the relevant <div> in my popup but I can't figure out how to make it visible again. I think I need to use some JavaScript, but that seems to get stripped from the popup (presumably a security risk?).
Any help would be greatly appreciated.
Solved! Go to Solution.
One way to accomplish this could be to use the HTML details disclosure element. This creates a collapsible section using only HTML. If you click on one of the ballot drop box locations in this map you'll see the collapsible area.
<details>
<summary>Drop Box Location:</summary>
<p>
{boxlocdesc}
</p>
</details>
One way to accomplish this could be to use the HTML details disclosure element. This creates a collapsible section using only HTML. If you click on one of the ballot drop box locations in this map you'll see the collapsible area.
<details>
<summary>Drop Box Location:</summary>
<p>
{boxlocdesc}
</p>
</details>
Hi @KellyHutchins, thanks for the tip. I had no idea about the details/summary element in HTML. I got it to work fine in the Web Map, although when I use the map in a Dashboard the expand/collapse arrow is not displayed, but I presume that's down to some CSS in ArcGIS Dashboards that I can't (easily) access:
I'm happy this is working well enough in the Dashboard even without the expand/collapse arrow.
Thanks again.
You might be able to get the arrow to show by modifying the popup html a bit. Here's what worked for me in dashboard. I added style="display:revert;" to overwrite a dashboard style applied to the summary element.
<details>
<summary style="display:revert;">Drop Box Location:</summary>
<p>
{fulladdr}
</p>
</details>
Thanks @KellyHutchins, that worked a treat. Here's how it looks in the Dashboard now:
Thanks again - Ian