Infobox Class

Bing
 

An infobox, also sometimes refer to as an info window or popup, is a simple panel that displays information over top the map. This is often used to display information linked to a location after clicking on a pushpin.

Infobox(location: Location, options?: InfoboxOptions)

When creating an infobox a location must be passed as an argument to the constructor. Optionally, infobox options can also be passed in as an argument.

Here is a list of methods available in the Infobox class.

NameReturn TypeDescription
getActions()InfoboxActions[]Returns a list of the infobox actions, where each item is a label (the link text) or icon (the URL of the image to use as the icon link) and eventHandler (name of the function handling a click of the action link). Note that this is not supported when using htmlContent, use HTML anchors instead.
getAnchor()PointReturns the point on the infobox which is anchored to the map. An anchor of (0,0) is the top left corner of the infobox.
getDescription()stringReturns the string that is printed inside the infobox.
getHeight()numberReturns the height of the infobox.
getHtmlContent()stringReturns the infobox as HTML.
getLocation()LocationReturns the location on the map where the infobox’s anchor is attached.
getMaxHeight()numberGets the maximium height setting for the infobox.
getMaxWidth()numberGets the maximium width setting for the infobox.
getOffset()PointReturns the amount the infobox pointer is shifted from the location of the infobox, or if showPointer is false, then it is the amount the infobox bottom left edge is shifted from the location of the infobox. The default value is (0,0), which means there is no offset.
getOptions()InfoboxOptionsReturns the infobox options.
getShowCloseButton()booleanReturns a boolean indicating whether the infobox close button is shown.
getShowPointer()booleanReturns a boolean indicating whether the infobox is drawn with a pointer.
getTitle()stringReturns a string that is the title of the infobox.
getVisible()booleanReturns whether the infobox is visible. A value of false indicates that the infobox is hidden, although it is still an entity on the map.
getWidth()numberReturns the width of the infobox.
getZIndex()numberGets the z-index of the infobox.
setHtmlContent(content: string)Sets the HTML content of the infobox. You can use this method to change the look of the infobox. Note that infobox options are ignored if custom HTML is set. Also, when custom HTML is used to represent the infobox, the infobox is anchored at the bottom-left corner.
setLocation(loc: Location)Sets the location on the map where the anchor of the infobox is attached.
setMap(map: Map)Adds the infobox to the map. To remove an Infobox from the map, simply pass null into this function. Note: Calling this function removes all event handlers from the infobox. Add your event handlers to the infobox after calling this function.
setOptions(opt: InfoboxOptions)Sets options for the infobox.
NameArgumentsDescription
clickInfoboxEventArgsOccurs when the mouse is used to click the infobox.
infoboxChangedInfoboxEventArgsOccurs when the locations/rings or options of the polygon has changed.
mouseenterInfoboxEventArgsOccurs when the mouse cursor enters the infobox area.
mouseleaveInfoboxEventArgsOccurs when the mouse cursor moves out of the infobox area.
Show: