google.maps.Marker 对象

Constructor Description
Marker(opts?:MarkerOptions) Creates a marker with the options specified. If a map is specified, the marker is added to the map upon construction. Note that the position must be set for the marker to display.
方法 返回值 描述
getAnimation() Animation  
getClickable() boolean  
getCursor() string  
getDraggable() boolean  
getIcon() string|Icon|Symbol  
getMap() Map|StreetViewPanorama  
getOpacity() number  
getPosition() LatLng  
getShape() MarkerShape  
getTitle() string  
getVisible() boolean  
getZIndex() number  
setAnimation(animation:Animation) None Start an animation. Any ongoing animation will be cancelled. Currently supported animations are: BOUNCE, DROP. Passing innull will cause any animation to stop.
setClickable(flag:boolean) None  
setCursor(cursor:string) None  
setDraggable(flag:boolean) None  
setIcon(icon:string|Icon|Symbol) None  
setMap(map:Map|StreetViewPanorama) None Renders the marker on the specified map or panorama. If map is set to null, the marker will be removed.
setOpacity(opacity:number) None  
setOptions(options:MarkerOptions) None  
setPosition(latlng:LatLng|LatLngLiteral) None  
setShape(shape:MarkerShape) None  
setTitle(title:string) None  
setVisible(visible:boolean) None  
setZIndex(zIndex:number) None
事件 参数 描述
animation_changed None This event is fired when the marker's animation property changes.
click MouseEvent This event is fired when the marker icon was clicked.
clickable_changed None This event is fired when the marker's clickable property changes.
cursor_changed None This event is fired when the marker's cursor property changes.
dblclick MouseEvent This event is fired when the marker icon was double clicked.
drag MouseEvent This event is repeatedly fired while the user drags the marker.
dragend MouseEvent This event is fired when the user stops dragging the marker.
draggable_changed None This event is fired when the marker's draggable property changes.
dragstart MouseEvent This event is fired when the user starts dragging the marker.
flat_changed None This event is fired when the marker's flat property changes.
icon_changed None This event is fired when the marker icon property changes.
mousedown MouseEvent This event is fired for a mousedown on the marker.
mouseout MouseEvent This event is fired when the mouse leaves the area of the marker icon.
mouseover MouseEvent This event is fired when the mouse enters the area of the marker icon.
mouseup MouseEvent This event is fired for a mouseup on the marker.
position_changed None This event is fired when the marker position property changes.
rightclick MouseEvent This event is fired for a rightclick on the marker.
shape_changed None This event is fired when the marker's shape property changes.
title_changed None This event is fired when the marker title property changes.
visible_changed None This event is fired when the marker's visible property changes.
zindex_changed None This event is fired when the marker's zIndex property changes.

MarkerOptions 对象

Properties Type Description
anchorPoint Point The offset from the marker's position to the tip of an InfoWindow that has been opened with the marker as anchor.
animation Animation Which animation to play when marker is added to a map.
clickable boolean If true, the marker receives mouse and touch events. Default value is true.
crossOnDrag boolean If false, disables cross that appears beneath the marker when dragging. This option is true by default.
cursor string Mouse cursor to show on hover
draggable boolean If true, the marker can be dragged. Default value is false.
icon string|Icon|Symbol Icon for the foreground. If a string is provided, it is treated as though it were an Icon with the string as url.
map Map|StreetViewPanorama Map on which to display Marker.
opacity number The marker's opacity between 0.0 and 1.0.
optimized boolean Optimization renders many markers as a single static element. Optimized rendering is enabled by default. Disable optimized rendering for animated GIFs or PNGs, or when each marker must be rendered as a separate DOM element (advanced usage only).
position LatLng Marker position. Required.
shape MarkerShape Image map region definition used for drag/click.
title string Rollover text
visible boolean If true, the marker is visible
zIndex number All markers are displayed on the map in order of their zIndex, with higher values displaying in front of markers with lower values. By default, markers are displayed according to their vertical position on screen, with lower markers appearing in front of markers further up the screen.