Get the App
SLTechnology News&Howtos  ›  Network Security  › 

What is the javascript function used in Baidu Map?

Shulou Source: shulou.com Published: 2022-05-31 16:11:47 10月05日 Update

This article mainly explains "what is the javascript function used by Baidu Map". The content of the explanation in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "what is the javascript function used by Baidu Map"?

Collation of js functions used in Baidu Maps developed by javascript

/ / create and initialize map function: function initMap () {createMap (); / / create map setMapEvent (); / / set map event addMapControl (); / / add control addMarker () to map; / / add marker} / / create map function: function createMap () {var map = new BMap.Map ("container") / / create a map var point = new BMap.Point (116.395645 map.centerAndZoom 39.929986) in the Baidu map container; / / define a center point coordinate map.centerAndZoom (point,12); / / set the center point and coordinates of the map and display the map in the map container window.map = map / / store the map variable in the global} / / Map event setting function: function setMapEvent () {map.enableDragging (); / enable the map drag event, and enable (but not write) map.enableScrollWheelZoom (); / / enable the map wheel to zoom in and out of map.enableDoubleClickZoom (); / / enable mouse double click to zoom in, and enable (but not write) map.enableKeyboard () by default / / enable the keyboard keys to move the map around} / / add a function to the map control: function addMapControl () {/ / add a zoom control var ctrl_nav = new BMap.NavigationControl ({anchor:BMAP_ANCHOR_TOP_LEFT,type:BMAP_NAVIGATION_CONTROL_LARGE}); map.addControl (ctrl_nav) / / add thumbnail controls var ctrl_ove = new BMap.OverviewMapControl ({anchor:BMAP_ANCHOR_BOTTOM_RIGHT,isOpen:1}); map.addControl (ctrl_ove); / / add scale bar controls var ctrl_sca = new BMap.ScaleControl ({anchor:BMAP_ANCHOR_BOTTOM_LEFT}); map.addControl (ctrl_sca) to the map } / / Annotation points array var markerArr = [{title: "my Mark", content: "my remarks", point: "116.354539 | 39.970253", isOpen:0,icon: {were2l var 21LRO LRV 0LRO LRV 0LRO LRV 6LBRO}}]; / create marker function addMarker () {for (var item0teri)

Tags: Maps functions controls events learning but not center points content coordinates containers up and down up and down global variables notes that is ideas situations arrays articles Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei NVidia MariaDB OPPO Reno vpn