最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to remove RichMarker shadow class from google maps api? - Stack Overflow

programmeradmin0浏览0评论

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:

My question is: How to remove this shadow'

Realy thanks for help.

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:

My question is: How to remove this shadow'

Realy thanks for help.

Share Improve this question asked Apr 13, 2015 at 12:44 DaniKRDaniKR 2,44810 gold badges41 silver badges50 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 10

Have you tried:

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

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./maps/api/js"></script>
<script src="https://google-maps-utility-library-v3.googlecode./svn/trunk/richmarker/src/richmarker.js"></script>
<div id="map_canvas" style="border: 2px solid #3872ac;"></div>

发布评论

评论列表(0)

  1. 暂无评论