Web pages nested several steps in place :
Address: http://api.map.baidu.com/lbsapi/creatmap/index.html;
Enter the location you want to target, add annotations, get the code, and copy it to your page.
But the volume is big, in the mobile phone side very card.
Mobile phone side:
Mobile-side nesting:
The code is as follows:
<body>
<legend> Online Map </legend>
<div id= ' allmap ' style= ' width:100%; height:360px ' ></div>
<script type= ' text/javascript ' src= ' http://api.map.baidu.com/api?type=quick&ak= 56563710f7448264e407591367dc1d77&v=1.0 ' ></script>
<script type= ' Text/javascript ' >
Baidu Map API Features
var map = new Bmap.map (' Allmap '); Create a Map instance
Map.addcontrol (New Bmap.zoomcontrol ()); Adding a Zoom control
Map.addcontrol (New Bmap.scalecontrol ()); Add a scale bar control
var point = new Bmap.point (116.486588,40.003082);
var marker = new Bmap.marker (point); Create a callout
Map.addoverlay (marker); Add a callout to a map
Map.centerandzoom (Point, 15);
var opts = {
WIDTH:120,//Information window width
HEIGHT:30,//Information window height
Title: ' Ingenious Travel ',//Information window title
Enableautopan:true//Automatic panning
}
var Infowindow = new Bmap.infowindow (' Ingenious Travel ', opts); Create an Information Window object
Marker.addeventlistener (' click ', function () {
Map.openinfowindow (Infowindow,point); Open Information window
});
</script>
</body>
Once encountered a headache problem, some phones show normal, some show all white , and mobile phone model no rule ! A variety of problems can not be found, ultimately because, #allmap外层div宽高用的百分比, so that the map height of 0! Phone-side definition height:20%; This ensures that the parent div height is fixed! Remember.
Mobile/web-nested Baidu Map