DaniKR
DaniKR

Reputation: 2448

How to remove RichMarker shadow class from google maps api?

For creating own <div> in my google maps api I have used RichMarker library, documentation here: (link) and library here: (link). So my code look like this:

for(i = 0; i < location.length; i++){
    var loc = location[i];
    var coordinates = new google.maps.LatLng(loc[1], loc[2]);
    var marker = new RichMarker({
        position: coordinates,
        map: map,
        zIndex: coordinates[3],
        content: '<div class="myClass">TEXT</div>'
    });
}

Now code above draw a shadow around my div (this is not my css, that draw a shadow, I gues that it is css from RichMarker library). Here is a picture:

enter image description here

My question is: How to remove this shadow'

Realy thanks for help.

Upvotes: 4

Views: 2380

Answers (2)

geocodezip
geocodezip

Reputation: 161384

Per the documentation the setShadow method lets you change the shadow.

marker.setShadow("");

proof of concept fiddle

code snippet:

var geocoder;
var map;
var locations = [
  ['Bondi Beach', -33.890542, 151.274856, 4],
  ['Coogee Beach', -33.923036, 151.259052, 5],
  ['Cronulla Beach', -34.028249, 151.157507, 3],
  ['Manly Beach', -33.80010128657071, 151.28747820854187, 2],
  ['Maroubra Beach', -33.950198, 151.259302, 1]
];

function initialize() {
  var map = new google.maps.Map(
    document.getElementById("map_canvas"), {
      center: new google.maps.LatLng(37.4419, -122.1419),
      zoom: 13,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    });
  var bounds = new google.maps.LatLngBounds();
  for (i = 0; i < locations.length; i++) {
    var loc = locations[i];
    var coordinates = new google.maps.LatLng(loc[1], loc[2]);
    bounds.extend(coordinates);
    var marker = new RichMarker({
      position: coordinates,
      map: map,
      zIndex: coordinates[3],
      content: '<div class="myClass">TEXT</div>'
    });
    var shadow = marker.getShadow();
    marker.setShadow("");
  }
  map.fitBounds(bounds);


}
google.maps.event.addDomListener(window, "load", initialize);
html,
body,
#map_canvas {
  height: 100%;
  width: 100%;
  margin: 0px;
  padding: 0px
}
<script src="https://maps.googleapis.com/maps/api/js"></script>
<script src="https://google-maps-utility-library-v3.googlecode.com/svn/trunk/richmarker/src/richmarker.js"></script>
<div id="map_canvas" style="border: 2px solid #3872ac;"></div>

Upvotes: 1

Drazen Bjelovuk
Drazen Bjelovuk

Reputation: 5482

Have you tried:

var marker = new RichMarker({
        position: coordinates,
        map: map,
        zIndex: coordinates[3],
        shadow: 'none',
        content: '<div class="myClass">TEXT</div>'
    });

Upvotes: 10

Related Questions