- var init = function() {
- var map = new qq.maps.Map(document.getElementById("container"), {
- center: new qq.maps.LatLng(39.916527, 116.397128),
- zoom: 13,
- //启用平移控件
- panControl: true,
- //设置平移控件的位置
- panControlOptions: {
- //设置平移控件的位置为相对右方中间位置对齐.
- position: qq.maps.ControlPosition.RIGHT_CENTER
-
- }
-
- });
-
- }
- <!DOCTYPE html>
- <html>
-
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
- <title>设置平移控件位置</title>
- <style type="text/css">
- * {
- margin: 0px;
- padding: 0px;
- }
- body,
- button,
- input,
- select,
- textarea {
- font: 12px/16px Verdana, Helvetica, Arial, sans-serif;
- }
- p {
- width: 603px;
- padding-top: 3px;
- overflow: hidden;
- }
- .btn {
- width: 142px;
- }
- </style>
- <script charset="utf-8" src="https://map.qq.com/api/js?v=2.exp&key=OB4BZ-D4W3U-B7VVO-4PJWW-6TKDJ-WPB77"></script>
-
- </head>
-
- <body onload="init()">
- <script>
- var init = function() {
- var map = new qq.maps.Map(document.getElementById("container"), {
- center: new qq.maps.LatLng(39.916527, 116.397128),
- zoom: 13,
- //启用平移控件
- panControl: true,
- //设置平移控件的位置
- panControlOptions: {
- //设置平移控件的位置为相对右方中间位置对齐.
- position: qq.maps.ControlPosition.RIGHT_CENTER
-
- }
-
- });
-
- }
- </script>
- <div style="width:603px;height:300px" id="container"></div>
-
- </body>
-
- </html>