1
我试图创建基于位置()方法对小叶JS地图类单张JS:做活动对象需要定义事件处理
这里成功的事件处理程序之前被实例化是我在瞬间:
function initMap() {
var map = L.map('map').locate({setView: false});
map.on('locationfound', function(s) {
map.setView(s.latlng).setZoom(14);
});
map.on('locationerror', function(e) {
message: 'Sorry, We were unable to determine your current location.';
});
L.tileLayer('http://{s}.tile.cloudmade.com/0e35616818144f159fa412e57f190939/997/256/{z}/{x}/{y}.png', {
attribution: 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="http://cloudmade.com">CloudMade</a>',
maxZoom: 18
}).addTo(map);
}
是“s”或“E”需要定义事件处理程序之前被启动,或者确实S和E假设通过事件处理程序的作用LocationEvent对象。如果是这样,那么执行此操作的正确方法是什么?