博客原地址https://xgs888.top/post/view?id=25
推荐一个很强大的js插件库leaflet;里面包含了很多地图类插件;热图,轨迹,画图等等
<div class="col-sm-12"> <div id="holder" style="cursor: default"></div> </div> <script type="text/javascript"> var mymap = L.map('holder', { crs: L.CRS.Simple, zoomSnap:0.5, dragging:true,//地图拖动 touchZoom:true,//手机放大缩小 doubleClickZoom:false,//双击地图变大 animate:false }); var bounds = [[0, 0], [<{$map.width}>, <{$map.height}>]]; var image = L.imageOverlay('images/map.jpg', bounds).addTo(mymap); mymap.setView([<{$map.width}>/2 , <{$map.height}>/2],1); //鼠标右键 mymap.on('contextmenu',function(e){ console.log(e.latlng); }); //双击 mymap.on('dblclick', function(e){ console.log(e.latlng); }); //鼠标滑过 mymap.on('mousemove', function(e){ console.log(e.latlng); });