Baidu Map API to implement the tagging function, one is to use the marker in the overlay directly, so the advantage is that you can directly use the Official 2.0 to provide a variety of interfaces, but some complex requirements to achieve some cumbersome, such as the mouse to follow the model changes, click on the model changes and so on.
Another option is to use the Markertool Open Source Library provided in the 1.2 interface, which is basically enough for the real-world tagging function (http://developer.baidu.com/map/index.php?title=open/library)
However, when you implement a click event listener after labeling is added, you need to make appropriate changes to the source code, such as the Click event listener that implements the tag icon
Think of it like this:
Mkrtool.addeventlistener ("click", Function (e) {alert ("test"); });
In fact, the actual modification point should be the _clickhandler method in source code markertool.js, because the instance of Markertool will remove the click event after the clicked event is added, and it is only for the map object, as follows:
var MKR = new Bmap.marker (PT, {Icon:me._opts.icon}); This adds marker monitor Mkr.addeventlistener ("click", Function (e) {alert ("test"); }); Me._map.addoverlay (MKR);
Baidu Map Api--markertool Click Add to Event