Information window
-----Plain Text Information window
To make it easier to prompt the user, add a window of text information to the specified place in the map, give the user a visual display of the information, and below is how to add a plain text information window.
Here is a text window to add:
/* * Add plain Text Information window */function Addtextinfowindow (map) {var opts = {width: 200, // Information window width height: 60, //Information window height title: //Information window title enablemessage: true,//settings allow message window to send short message: " Welcome to Xian Merrill Lynch Electronics Co., Ltd. ... " //message content} var Infowindow = new Bmap.infowindow ( //Create Information Window object map.openinfowindow (Infowindow, map.getcenter ()); //Open Info Window}
-----Complex Information window
The information window is constantly able to display plain text, but also can show the complex information such as pictures, so that we have a certain HTML basis, the following describes how to add a complex text information window.
/* Add complex information window */functionAddcomplexinfowindow (MAP) {Stitching HTML stringsvar scontent ="" "+ " <p style= ' margin:0;line-height:1.5;font-size:13px;text-indent:2em ' > Han Yun Court is located in Xi ' an software park ...</p> "+ "</div>"; var marker = New Bmap.marker (Map.getcenter ()); var Infowindow = new Bmap.infowindow (scontent); //Create Information Window object Map.addoverlay (marker); Marker.addeventlistener ("click", function () {// Called the Openinfowindow method of the Marker object This.openinfowindow (Infowindow);});
Baidu Map api--Information window