百度地图Api进阶教程-地图鼠标左右键操作实例和鼠标样式6.html
来源:互联网 发布:淘宝买家退款率怎么查 编辑:程序博客网 时间:2024/05/02 00:51
转载: http://blog.csdn.net/sd0902/article/details/8478435
- <!DOCTYPE html>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>百度地图</title>
- <script type="text/javascript">
- var iscreatr=false;
- function initialize() {
- //---------------------------------------------基础示例---------------------------------------------
- var map = new BMap.Map("allmap",{minZoom:12,maxZoom:20}); // 创建Map实例
- //map.centerAndZoom(new BMap.Point(116.4035,39.915),15); //初始化时,即可设置中心点和地图缩放级别。
- map.centerAndZoom("成都",13); // 初始化地图,设置中心点坐标和地图级别。
- map.enableScrollWheelZoom(true);//鼠标滑动轮子可以滚动
- //---------------------------------------------鼠标右键(放大,缩小)操作---------------------------------------------
- var menu = new BMap.ContextMenu(); //右键菜单
- var txtMenuItem = [ //右键菜单项目
- {
- text:'放大',
- callback:function(){map.zoomIn()}
- },
- {
- text:'缩小',
- callback:function(){map.zoomOut()}
- },
- {
- text:'放置到最大级',
- callback:function(){map.setZoom(18)}
- },
- {
- text:'查看全国',
- callback:function(){map.setZoom(4)}
- },
- {
- text:'在此添加标注',
- callback:function(p){
- var marker = new BMap.Marker(p), px = map.pointToPixel(p);
- map.addOverlay(marker);
- }
- }
- ];
- for(var i=0; i < txtMenuItem.length; i++){
- menu.addItem(new BMap.MenuItem(txtMenuItem[i].text,txtMenuItem[i].callback,100)); //菜单添加项目
- if(i==1 || i==3) {
- menu.addSeparator(); //添加右键菜单的分割线
- }
- }
- map.addContextMenu(menu);
- //---------------------------------------------改变鼠标样式---------------------------------------------
- //需要自己制作。cur格式的静态光标
- //map.setDefaultCursor("url('01.cur')"); //设置地图默认的鼠标指针样式
- //map.setDraggingCursor("url('03.cur')"); //设置地图拖拽时的鼠标指针样式
- }
- function loadScript() {
- var script = document.createElement("script");
- script.src = "http://api.map.baidu.com/api?v=1.4&callback=initialize";
- document.body.appendChild(script);
- }
- window.onload = loadScript;
- </script>
- </head>
- <body>
- <div id="r-result" style="float:left;width:100px;">打印坐标</div>
- <div id="allmap" style="width: 800px; height: 500px"></div>
- </body>
- </html>
- <script type="text/javascript">
- // 移动到某点 map.panTo(new BMap.Point(116.409, 39.918));
- // map.setZoom(14); //放到到14级
- </script>
- 百度地图Api进阶教程-地图鼠标左右键操作实例和鼠标样式6.html
- 百度地图Api进阶教程-地图鼠标左右键操作实例和鼠标样式6.html
- 百度地图Api进阶教程-实例高级操作8.html
- 百度地图Api进阶教程-实例高级操作8.html
- 地图API操作之鼠标右键菜单
- 百度地图修改鼠标样式
- 百度地图修改鼠标样式
- 百度地图Api进阶教程-基础地图示例1.html
- 百度地图Api进阶教程-基础地图示例1.html
- 百度地图Api进阶教程-弹出信息窗口5.html
- 百度地图Api进阶教程-点聚合9.html
- 百度地图Api进阶教程-弹出信息窗口5.html
- 百度地图Api进阶教程-点聚合9.html
- 设置地图鼠标样式
- 百度地图Api进阶教程-默认控件和自定义控件2.html
- 百度地图Api进阶教程-创建标注和自定义标注3.html
- 百度地图Api进阶教程-点击生成和拖动标注4.html
- 百度地图Api进阶教程-用户自定义数据(标记和搜索)7.html
- 百度地图Api进阶教程-弹出信息窗口5.html
- 统计语言模型学习笔记
- Android---构建一个OpenGL ES环境
- MS VC6 链接错误处理
- 百度地图Api进阶教程-用户自定义数据(标记和搜索)7.html
- 百度地图Api进阶教程-地图鼠标左右键操作实例和鼠标样式6.html
- quartus错误整理
- 巧用 HTML5 audio 打印文件夹下mp3文件的长度列表
- 关于Build Active Architecture Only属性
- 百度地图Api进阶教程-实例高级操作8.html
- java定时任务,每天定时执行任务
- 百度地图Api进阶教程-点聚合9.html
- 使用VBA,20行代码 将Excel数据导出
- quartus_ii_常见的19个错误、28个警告