더 이상 고민하지 않고, 나는 당신에게 직접 코드를 게시하겠습니다. 특정 코드는 다음과 같습니다.
키 코드는 다음과 같습니다.
<! doctype html> <html lang = "zh-cn"> <head> <meta name = "viewport"content = "initial-scale = 1.0, user-scalable = no" /> <meta http-equiv = "content-type"content = "text /html; charset = utf-8" /> <tittle> type = "text/css"> html {height : 100%;} body {height : 100%; 마진 : 0px; 패딩 : 0px;}#컨테이너 {height : 50%;} </style> <script src = "http://code.-jquery.com/jquery-11.11.0.min.js"> </script> src = "http://api.map.baidu.com/api?v=1.4"type = "text/javaScript"> </script> <script type = "text/javaScript"src = "http://developer.baidu.com/map/jsdemo/democ.js"> {navigator.geolocation.getCurrentPosition (TranslatePoint); // position}); function translatepoint (position) {var currentlat = position.latitude; // engitude var currentlon = position.coords.longitud; // latitude var gpspoint = new bmap.point (currentlon, currentlat); // coordinates} function initmap (point) {// 맵 map 초기화 맵 = new bmap.map ( "컨테이너"); // 인스턴스 컨테이너 map.addControl (new bmap.navigationControl ()); // Zoom Zoom Control Map.addControl (new bmap.scalecontrol ()); // scale 컨트롤 (newddcontrol); bmap.overViewMapControl ()); // 썸네일 맵 제어 map.centerandzoom (point, 15); // 맵 초기화, 매개 변수 맵 좌표 및 레벨 맵. Addoverlay (new bmap.marker (point)); // 현재 위치에 가입 var var myzoomctrl = new ZoomControl (); map.addControl (myzoomctrl); function ZoomControl () {this.defaultAnchor = bmap_anchor_top_left; // 컨트롤의 위치 조정 this.defaultOffset = new bmap.size (10, 10); // 픽셀을 통해 위치 조정} // 컨트롤을 사용자 정의하고 배율 ZoomControl.prototype = new Bmap.control (); ZoomControl.prototype.initialize = function = Document.CreateElement ( "div"); div.appendChild (div.AppendChild (Document.CreateTextNode ( "Zoomination 2 Levings")); div.style.cursor = "Pointer"; div.style.border = "1px Solid Grey"; Div.Style.backgroundColor = "White"; div.onclick = function (e) {Map.zoomto 2);} map.getContainer (). 부록 (div); return div;}} </script> </head> <body> <div id = "컨테이너"> </div> </body> </html>