ユーザーの現在の場所を表示するボタンをマップの上に追加しようとしています。
基本的に、組み込みのボタンの機能を複製したいのですが、より明白なものを作りたいと思っています。
これが私のコードです:
<script>
var map = L.mapbox.map('map', 'plisvb.hopljoko');
L.control.locate({
drawCircle: true, // controls whether a circle is drawn that shows the uncertainty about the location
setView: true, // automatically sets the map view to the user's location, enabled if `follow` is true
keepCurrentZoomLevel: false, // keep the current map zoom level when displaying the user's location. (if `false`, use maxZoom)
icon: 'icon-location', // `icon-locate` or `icon-direction`
iconLoading: 'icon-spinner animate-spin', // class for loading icon
circlePadding: [0, 0], // padding around accuracy circle, value is passed to setBounds
locateOptions: {
maxZoom: 15
},
strings: {
title: "Click to see your current location", // title of the locate control
popup: "Your current location", // text to appear if user clicks on circle
outsideMapBoundsMsg: "You seem located outside the boundaries of the map" // default message for onLocationOutsideMapBounds
}
}).addTo(map);
map.scrollWheelZoom.disable();
</script>
何か案は?