Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Z-Index on Google Maps Markers?

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #255015
    ruby76
    Participant

    Hello – I’ve got a custom Google map that I’ve generated through mapkit.io, and I have a decent understanding of JavaScript and the code it’s provided. All is well except one thing: I can’t get the marker for the actual business I’m trying to highlight to show up on top. Google’s documentation says you can add a z-index in JS at the end of the marker line — i.e. lat, lng, z-index, but this doesn’t seem to be working.

    This is where I tried to add it — position: new google.maps.LatLng(locations[i].lat, locations[i].lng, i)

    I’m basically trying to use the existing counter variable (“i”) in the JS “for” loop that generates each marker on the map, to also represent z-index. So as each one is added, “i” increases, so the highest number will apply to the last marker in the list. That’s where I put the business represented on the website (Russell Hall). I had hoped this would get it to show up on top, but no luck. Any ideas on how to accomplish this would be hugely appreciated!

    CodePen link here: https://codepen.io/ruby76/pen/aWRBYd
    Actual site in progress here: http://russellhallatuw.com/home-test

    Thanks in advance for any help!

Viewing 1 post (of 1 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.