Scott B
Scott B

Reputation: 40237

Need Google "My Maps" Legend Opened at Startup

I have a Google "My Maps" listing that relies heavily on a layered legend display to navigate 5 layers I'm displaying. I'd like the legend to be open by default when the iframe is loaded.

Ideally, I'd be able to pass a parameter on the iframe SRC url to tell the "my maps" server to display the legend at startup. It should be a simple CSS toggle from display:none to display:block.

This question has been asked back in 2015 on the Google Help Forum but is now locked.

Interestingly, when you click the full screen expansion icon to view the map at full size, it does display the legend by default. Perhaps there are some clues on that URL that may be sniffed out. It reloads the map and uses a different URL than the embed src.

Here is a link to the map on my site for reference.

Here is the legend container html from the "My Maps" code when the legend is closed at startup:

<div aria-hidden="true" id="legendPanel" style="bottom: 0px !important; display: none;" class="HzV7m-b0t70b-haAclf i4ewOd-mU4ghb-haAclf">

And here is the code when the legend is visible:

<div aria-hidden="false" id="legendPanel" style="bottom: 0px !important;" class="HzV7m-b0t70b-haAclf i4ewOd-mU4ghb-haAclf HzV7m-b0t70b-bnBfGc HzV7m-b0t70b-ZiwkRe">

Although, since its not possible to execute CSS in the iframe due to XSS limitations, its only shown here to see how the legend is toggled on and off via CSS display property.

Upvotes: 3

Views: 2482

Answers (0)

Related Questions