如何从 google 地图 api 中删除 RichMarker 阴影 class?
How to remove RichMarker shadow class from google maps api?
为了在我的 google 地图中创建自己的 <div>
api 我使用了 RichMarker 库,文档在这里:(link) and library here: (link)。所以我的代码看起来像这样:
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>'
});
}
现在上面的代码在我的 div 周围画了一个阴影(这不是我的 css,我猜它是来自 RichMarker 库的 css)。这是一张图片:
我的问题是:如何去掉这个阴影'
非常感谢您的帮助。
你试过了吗:
var marker = new RichMarker({
position: coordinates,
map: map,
zIndex: coordinates[3],
shadow: 'none',
content: '<div class="myClass">TEXT</div>'
});
根据 the documentation,setShadow 方法可让您更改阴影。
marker.setShadow("");
代码片段:
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>
为了在我的 google 地图中创建自己的 <div>
api 我使用了 RichMarker 库,文档在这里:(link) and library here: (link)。所以我的代码看起来像这样:
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>'
});
}
现在上面的代码在我的 div 周围画了一个阴影(这不是我的 css,我猜它是来自 RichMarker 库的 css)。这是一张图片:
我的问题是:如何去掉这个阴影'
非常感谢您的帮助。
你试过了吗:
var marker = new RichMarker({
position: coordinates,
map: map,
zIndex: coordinates[3],
shadow: 'none',
content: '<div class="myClass">TEXT</div>'
});
根据 the documentation,setShadow 方法可让您更改阴影。
marker.setShadow("");
代码片段:
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>