Select to view content in your preferred language

Create an expand/collapse section in Map Viewer popup

287
4
Jump to solution
a month ago
Labels (2)
MappyIan
Frequent Contributor

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:

MappyIan_0-1750428083490.png

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:

MappyIan_1-1750428250970.png

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.

0 Kudos
1 Solution

Accepted Solutions
KellyHutchins
Esri Notable Contributor

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>

KellyHutchins_0-1750701137720.png

KellyHutchins_2-1750701190742.png

 

 

 

View solution in original post

4 Replies
KellyHutchins
Esri Notable Contributor

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>

KellyHutchins_0-1750701137720.png

KellyHutchins_2-1750701190742.png

 

 

 

MappyIan
Frequent Contributor

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:

 

MappyIan_1-1750760193791.png  

MappyIan_2-1750760219070.png

I'm happy this is working well enough in the Dashboard even without the expand/collapse arrow.

MappyIan_3-1750760316237.png

Thanks again.

0 Kudos
KellyHutchins
Esri Notable Contributor

 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>

 

MappyIan
Frequent Contributor

Thanks @KellyHutchins, that worked a treat.  Here's how it looks in the Dashboard now:

MappyIan_0-1750840106021.png

Thanks again - Ian