Baidu map Loop to add labels, and loop for the mouse hover labels when the information window problem resolution

Source: Internet
Author: User

The device is labeled on the map
function Getgateinfo (VSID, VMap) {

var icon = ".. /content/easyui/themes/icons/gate.png ";
var Myicon = new Bmap.icon (Icon, New Bmap.size (32, 32), {
Offset:new Bmap.size (32, 32)
});

$.ajax ({
Type: "Post",
URL: "/monitormanage/getstationgate?" Sid= "+ VSID,
Success:function (obj) {

for (var i = 0; i < obj.length; i++) {
var Vgateid = Obj[i]. Gateid;
var vgatename = Obj[i]. Gatename;
var vlongitude = Obj[i]. longitude;
var vlatitude = Obj[i]. Latitude;

var point = new Bmap.point (Obj[i]. Longitude, Obj[i].     Latitude); POI Point coordinates
var marker = new Bmap.marker (point, {icon:myicon});
Vmap.addoverlay (marker);


(function (x) {
var point = new Bmap.point (Obj[x]. Longitude, obj[x].    Latitude); Create point coordinates
alert (point);
var marker = new Bmap.marker (Point,{icon:myicon});
Create an Information window object, in which you can write any HTML statement in quotation marks.
var Infowindow = new Bmap.infowindow
("<table class= ' mytable ' border= ' 0 ' cellspacing= ' 0 ' cellpadding= ' 0 ' >"
+ "<tr><td> Site name:" + obj[x]. Gatename
+ "</td></tr><tr><td> Longitude:" + obj[x]. Longitude
+ "</td></tr><tr><td> Latitude:" + obj[x]. Latitude
+ "</td></tr></table>");

Move the mouse over the callout point to happen
Marker.addeventlistener ("MouseOver", function () {
This.openinfowindow (Infowindow);
});

Move the cursor away from the callout point what's going to happen
Marker.addeventlistener ("Mouseout", function () {
This.closeinfowindow (Infowindow);
});
Vmap.addoverlay (marker);
}) (i);
Create an Information window object, in which you can write any HTML statement in quotation marks.
var Infowindow = new Bmap.infowindow
("<table class= ' mytable ' border= ' 0 ' cellspacing= ' 0 ' cellpadding= ' 0 ' >"
+ "<tr><td> Site name:" + vgatename
+ "</td></tr><tr><td> Longitude:" + vlongitude
+ "</td></tr><tr><td> Latitude:" + vlatitude
+ "</td></tr></table>");

Move the mouse over the callout point to happen
Marker.addeventlistener ("MouseOver", function () {
This.openinfowindow (Infowindow,point);
//});

Move the cursor away from the callout point what's going to happen
Marker.addeventlistener ("Mouseout", function () {
This.closeinfowindow (Infowindow, point);
//});
}
}

})
}

Baidu map Loop to add labels, and loop for the mouse hover labels when the information window problem resolution

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.