Kingwaytek

訊息視窗

調用 new mapPlus.InfoWindow(options),開始使用地圖訊息視窗API。

訊息視窗

開始使用

  • options (object): 必填,訊息視窗的參數。
NameDescription
options.position object必填,經緯度座標
options.content string HTMLElement必填,訊息視窗內容,可帶入文字,或是使用 HTMLElement 帶入 InfoWindow。
options.maxWidth string選填,訊息視窗的最大寬度,預設為 50%
options.closeButton boolean選填,訊息視窗是否要有關閉按鈕,預設為 true
options.closeOnClick boolean選填,點選地圖是否要關閉視窗,預設為 true
options.closeOnMove boolean選填,移動地圖是否要關閉視窗,預設為 flase
options.animation object選填,可添加地標的動畫,可套用 mapPlus.Animation.GROW

Examples

點選「開始使用」,即可開始操作地圖

設定內容

訊息視窗內容,可帶入文字,或是使用 HTMLElement 帶入 InfoWindow。

Examples

點選「開始使用」,即可開始操作地圖

動畫

可添加地標的動畫,可套用 mapPlus.Animation.GROW

Examples

點選「開始使用」,即可開始操作地圖

實例方法

setContent

setContent(content)

設定訊息視窗的內容。

Parameters

  • content (string | HTMLElement): 可帶入文字,或是使用 HTMLElement 帶入 InfoWindow。

Examples

setPosition

setPosition(lngLat)

設定訊息視窗的座標。

Parameters

  • lngLat (object): 經緯度座標。

Examples

getPosition

getPosition()

取得訊息視窗的座標。

Returns

object: 經緯度座標。

Examples

setAnimation

setAnimation(animation)

設定地標的動畫。

Parameters

  • animation (object): 動畫類型,可套用 mapPlus.Animation.GROW

Examples

open

open(options)

開啟訊息視窗。

Parameters

  • options (object): 選填,開啟訊息視窗的參數。
NameDescription
options.anchor object選填,訊息視窗需顯示在對應的地標,未設定則使用 InfoWindow({position}) 的座標位置。

Examples

點選「開始使用」,即可開始操作地圖

close

close()

關閉訊息視窗。

Examples