0
votes

I'm styling my marker in the google Maps API

var friend_marker = new google.maps
    .Marker({
      map: map,
      position: location,
      icon: {
        url: icon.png
      },
      zIndex: 1,
      draggable: true
    });

Using this overlayview:

  var myoverlay = new google.maps.OverlayView();
  myoverlay.draw = function() {
    this.getPanes().markerLayer.id = 'markerLayer';
  };
  myoverlay.setMap(map);

Which works fine. However, when changing the draggable to false,

draggable: false

None of the styling is applied. Why is this so? How can I keep the styling without the marker being draggable?

1
Please provide a Minimal, Complete, Tested and Readable example that demonstrates the issue. - geocodezip
What do you mean by "styling"? Is the icon.png animated? - Dr.Molle
I'm styling it using css: #markerLayer img {...} - jdfauw

1 Answers

0
votes

set the optimized-property of the marker to false.

Markers by default will be rendered via <canvas/> , not via <img/>, your selector will not match in this case.

When you set optimized to false the marker will be rendered as single <img/> (it will also be rendered as <img/> when you set draggable to true)