标签:1.0 滚轮 scala 微软雅黑 center ble add family margin
应用百度地图的API进行地图的显示:
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 5 <meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> 6 <style type="text/css"> 7 body, html,#allmap {width: 100%;height: 100%;overflow: hidden;margin:0;font-family:"微软雅黑";} 8 </style> 9 <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=密钥"></script> 10 <title>家乡地图显示</title> 11 </head> 12 <body> 13 <div id="allmap"></div> 14 </body> 15 </html> 16 <script type="text/javascript"> 17 // 百度地图API功能 18 var map = new BMap.Map("allmap"); // 创建Map实例 19 map.centerAndZoom(new BMap.Point(116.33,26.33), 11); // 初始化地图,设置中心点坐标和地图级别 20 //添加地图类型控件 21 map.addControl(new BMap.MapTypeControl({ 22 mapTypes:[ 23 BMAP_NORMAL_MAP, 24 BMAP_HYBRID_MAP 25 ]})); 26 map.setCurrentCity("石城县"); // 设置地图显示的城市 此项是必须设置的 27 map.enableScrollWheelZoom(true); //开启鼠标滚轮缩放 28 </script>
以上代码基本来源于百度地图。
标签:1.0 滚轮 scala 微软雅黑 center ble add family margin
原文地址:https://www.cnblogs.com/vagrant-yangshun/p/10317482.html