2014-01-27 63 views
1

How to change the cross below the marker?如何更改标记下方的十字(Google地图V3)?

如何更改标记下方的十字?

+0

你的代码是什么样的?你的标记是否可拖动?拖动时是否要删除十字架? 'crossOnDrag \t布尔型\t如果为false,则禁用拖动时出现在标记下方的交叉。此选项默认为true .'从[MarkerOptions文档](https://developers.google.com/maps/documentation/javascript/reference#MarkerOptions) – geocodezip

+0

@geocodezip我想在圈子中替换他。谢谢。 –

回答

2

没有基于API的选项来更改交叉。

有可能的CSS-解决方法:

img[src^='https://mts.googleapis.com/vt/icon/name=icons/spotlight/directions_drag_cross']{ 
    /*your custom image, 16*16, used as background*/ 
    background:url(http://i.imgur.com/FKMkIVQ.png); 
    /*give the default-image a large width, 
     it will be cropped to 16*16, so the cross will disappear*/ 
    width:200px !important; 
    height:200px !important; 
} 

问题:十字架的形象-SRC可能有一天会改变,那么选择将不再匹配。

演示:http://jsfiddle.net/doktormolle/m58A7/

一个更好的办法是禁用的交叉和观察的dragstart和dragend应用不同的标记(与自定义交叉),同时拖动。

+0

这正是我需要的。谢谢。 –

+0

如何更改谷歌地图上的指针? –

1

最简单的方法是使用set raiseOnDrag:false来标记选项。

var marker = new google.maps.Marker({ 
position: latLng, 
title: 'Point A', 
map: map, 
draggable: true, 
raiseOnDrag: false 

});

相关问题