[Mapbox GL]获取鼠标位置的坐标
来源:互联网 发布:饥荒 linux 汉化 编辑:程序博客网 时间:2024/05/22 14:27
展示鼠标悬停位置的像素和经纬度坐标
<!DOCTYPE html><html><head> <meta charset='utf-8' /> <title></title> <meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' /> <script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.29.0/mapbox-gl.js'></script> <link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.29.0/mapbox-gl.css' rel='stylesheet' /> <style> body { margin:0; padding:0; } #map { position:absolute; top:0; bottom:0; width:100%; } </style></head><body><style type='text/css'> #info { display: block; position: relative; margin: 0px auto; width: 50%; padding: 10px; border: none; border-radius: 3px; font-size: 12px; text-align: center; color: #222; background: #fff; }</style><div id='map'></div><pre id='info'></pre><script>mapboxgl.accessToken = '<your access token here>';var map = new mapboxgl.Map({ container: 'map', // container id style: 'mapbox://styles/mapbox/streets-v9', center: [-74.50, 40], // starting position zoom: 9 // starting zoom});map.on('mousemove', function (e) { document.getElementById('info').innerHTML = /* innerHTML 属性设置或返回表格行的开始和结束标签之间的 HTML */ // e.point is the x, y coordinates of the mousemove event relative // to the top-left corner of the map JSON.stringify(e.point) + '<br />' + // e.lngLat is the longitude, latitude geographical position of the event JSON.stringify(e.lngLat); /* JSON.stringify() 方法可以将任意的 JavaScript 值序列化成 JSON 字符串 */});</script></body></html>
0 0
- [Mapbox GL]获取鼠标位置的坐标
- [Mapbox GL]获取鼠标悬停位置的特性
- 获取鼠标位置坐标
- 获取鼠标位置的三维坐标
- js获取鼠标坐标位置
- 获取鼠标实时位置坐标
- JS获取鼠标的坐标和滚动条的位置
- JS获取鼠标的坐标和滚动条的位置
- 获取鼠标在图片坐标位置的小例子
- c# 获取全屏 中鼠标焦点的位置坐标
- JS获取页面鼠标点击位置的坐标
- [JavaScript]获取鼠标点击区域的相对、绝对位置坐标
- C#中如何获取鼠标的位置坐标
- JavaScript中几种获取鼠标点击坐标位置的方法
- 基于JavaScript实现 获取鼠标点击位置坐标的方法
- 获取事件目标对象的位置坐标或者鼠标位置坐标(兼容IE和火狐)
- 获取鼠标的坐标
- 获取鼠标的坐标
- ABBYY使用电子邮件发送OCR结果的教程
- Android 热修复框架 Tinker ( 二 )
- 理解RESTful架构
- C#调用文档选择框时抛出异常
- 如何在 github 网站上如何删除 repositoris
- [Mapbox GL]获取鼠标位置的坐标
- Ajax基础
- pat-a1037. Magic Coupon (25)
- javamail技术研究
- 对Scoket 的认识
- 使用Hbase协作器(Coprocessor)同步数据到ElasticSearch
- 深入分析Java I/O 工作机制
- Winodws 使用 websocket
- 电源测试中的恒流和恒阻负载应用