This article mainly introduces how to add notes for Baidu map coordinate pick-up in jqueryboxy. If you need a friend, you can refer to this document as a developer. This document is only used as a personal backup, it would be nice if I could help (I used php for development, but this is not much affected by js itself)
Here are several questions:
1. The script tag cannot be displayed on the page called by boxy. Otherwise, it cannot be displayed.
2. Pay attention to the process when calling boxy. First load the boxy and then render the map to the boxy page.
3. The loading js of Baidu map should be placed on the pop-up boxy page.
Note: The boxy page uses $. get ('/index. php? R = comm/map_coordinate ', function (data) {} method to call the page
The key trigger js is as follows:
The Code is as follows:
(Function (){
$ (Document). ready (function (){
$ ("# Mechine_mec_points"). click (function (){
_ MC. Map_coordinate.getcorrdinate ();
});
});
_ MC. Map_coordinate = {
Getcorrdinate: function (){
$. Get ('/index. php? R = comm/map_coordinate ', function (data) {// call the corresponding boxy page, there is only one id = allmap p
New Boxy (data, {// js with Baidu map AIP loaded outside
'Title': 'map coordinate picking ',
'Modal': true,
'Draggable': false,
'Unloadonhide ': true,
'Aftershow': function (){
Var map = new BMap. Map ("allmap ");
Map. centerAndZoom (new BMap. Point (106.566872, 29.536861), 17 );
Map. enableScrollWheelZoom (); // enables scroll wheel zoom in and out, which is disabled by default.
Map. enableContinuousZoom (); // enable map inertial drag and drop. disabled by default.
Function showInfo (e ){
$ ("# Mechine_mec_points"). val (e. point. lng + "," + e. point. lat );
}
Map. addEventListener ("click", showInfo );
} // Aftershow ends
});
Return false;
});
},
}
})();