Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/apache-kafka/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google maps 如何更改标记下方的十字(Google Map V3)?_Google Maps_Google Maps Api 3_Google Maps Markers - Fatal编程技术网

Google maps 如何更改标记下方的十字(Google Map V3)?

Google maps 如何更改标记下方的十字(Google Map V3)?,google-maps,google-maps-api-3,google-maps-markers,Google Maps,Google Maps Api 3,Google Maps Markers,如何更改标记下方的十字?没有基于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 th


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

没有基于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可能有一天会改变,那么选择器将不再匹配

演示:


更好的方法是禁用十字并观察dragstart和dragend,以便在拖动时应用不同的标记(使用自定义十字)。

最简单的方法是使用set-raiseOnDrag:false for marker options

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

}))

你的代码看起来像什么?你的记号笔可以拖动吗?拖动时是否要删除十字
crossOnDrag boolean如果为false,则在拖动时禁用标记下方显示的交叉。默认情况下,此选项为true。
从@geocodezip中,我想在圆圈中替换他。谢谢,这正是我需要的。非常感谢。