-->

google maps infobox above all other content z-inde

2019-01-29 02:19发布

问题:

I use infobox to attach a div to about 20 markers on a map. The div contains a anchor that shows up via classname:hover. This works as expected but alas: I really would like to have the box, that pops up at :hover to trump all other content on the page in order to make sure, the content of the box is not behind anything else.

I have applied position and z-index to all relevant elements on the page and the popup boxes have z-index 1000 while all other are below 100. Still the marker-image (z-index 80) covers the box. I tried to change panes and have set the index for the marker by using setZIndex to 80 but to no avail.

boxText.innerHTML = '<p class=\"sheikh_flag\"> <a   style=\"z-index:1000\" class=\"sheikh\" href=\"index.php\"> Linktext  </a>  Text   </p>';

Is there a way to make sure, that anchor class sheikh is always displayed atop all others?

回答1:

Z-index only works with elements that have position: relative / absolute / fixed