Baidu Map api--Information window

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.