AdvancedMarkerElement class
google.maps.marker.AdvancedMarkerElement
class
Shows a position on a map. Note that the position
must be set for the AdvancedMarkerElement
to display.
Custom element:
<gmp-advanced-marker anchor-left="string" anchor-top="string" gmp-clickable position="lat,lng" title="string"></gmp-advanced-marker>
This class extends
HTMLElement
.
This class implements
AdvancedMarkerElementOptions
.
Access by calling const {AdvancedMarkerElement} = await google.maps.importLibrary("marker")
.
See Libraries in the Maps JavaScript API.
Constructor | |
---|---|
AdvancedMarkerElement |
AdvancedMarkerElement([options]) Parameters:
Creates an AdvancedMarkerElement with the options specified. If a map is specified, the AdvancedMarkerElement is added to the map upon construction. |
Properties | |
---|---|
anchorLeft |
Type:
string optional A CSS length-percentage value which is used to offset the anchor point of the marker from the top left corner of the marker. This is useful when using a visual which has an anchor point that is different than the typical bottom center point of the default marker. The default value is "-%50".
HTML attribute:
|
anchorTop |
Type:
string optional A CSS length-percentage value which is used to offset the anchor point of the marker from the top left corner of the marker. This is useful when using a visual which has an anchor point that is different than the typical bottom center point of the default marker. The default value is "-%100".
HTML attribute:
|
collisionBehavior |
Type:
CollisionBehavior optional |
gmpClickable |
Type:
boolean optional HTML attribute:
|
gmpDraggable |
Type:
boolean optional |
map |
Type:
Map optional |
position |
Type:
LatLng|LatLngLiteral|LatLngAltitude|LatLngAltitudeLiteral optional HTML attribute:
|
title |
Type:
string HTML attribute:
|
zIndex |
Type:
number optional |
|
Type:
HTMLElement This field is read-only. The DOM Element backing the view. |
|
Type:
Node optional |
Methods | |
---|---|
addEventListener |
addEventListener(type, listener[, options]) Parameters:
Return Value:
void Sets up a function that will be called whenever the specified event is delivered to the target. See addEventListener |
addListener |
addListener(eventName, handler) Parameters:
Return Value:
MapsEventListener Resulting event listener.Adds the given listener function to the given event name in the Maps Eventing system. |
removeEventListener |
removeEventListener(type, listener[, options]) Parameters:
Return Value:
void Removes an event listener previously registered with addEventListener from the target. See removeEventListener. |
Events | |
---|---|
click |
function(event) Arguments:
This event is fired when the AdvancedMarkerElement element is clicked.Not available with addEventListener() (use gmp-click instead). |
drag |
function(event) Arguments:
This event is repeatedly fired while the user drags the AdvancedMarkerElement .Not available with addEventListener() . |
dragend |
function(event) Arguments:
This event is fired when the user stops dragging the AdvancedMarkerElement .Not available with addEventListener() . |
dragstart |
function(event) Arguments:
This event is fired when the user starts dragging the AdvancedMarkerElement .Not available with addEventListener() . |
|