Я на карте v2 - теперь с GPS
This commit is contained in:
parent
7fdf4f446d
commit
524da1831a
|
|
@ -105,15 +105,43 @@ function searchAdderess()
|
||||||
|
|
||||||
function showMeOnTheMap()
|
function showMeOnTheMap()
|
||||||
{
|
{
|
||||||
myMap.geoObjects.add(
|
var userLat = 0;
|
||||||
new ymaps.Placemark(
|
var userLng = 0;
|
||||||
[ymaps.geolocation.latitude, ymaps.geolocation.longitude],
|
navigator.geolocation.getCurrentPosition(function(pos) {
|
||||||
{
|
userLat = pos.coords.latitude;
|
||||||
balloonContentHeader: ymaps.geolocation.country,
|
userLng = pos.coords.longitude;
|
||||||
balloonContent: ymaps.geolocation.city,
|
|
||||||
balloonContentFooter: ymaps.geolocation.region
|
myMap.geoObjects.add(
|
||||||
},
|
new ymaps.Placemark(
|
||||||
{iconImageHref: '/ico/man.png', iconImageSize: [32, 37]}
|
[userLat, userLng],
|
||||||
)
|
{
|
||||||
);
|
balloonContentHeader: ymaps.geolocation.country,
|
||||||
|
balloonContent: ymaps.geolocation.city,
|
||||||
|
balloonContentFooter: ymaps.geolocation.region
|
||||||
|
},
|
||||||
|
{
|
||||||
|
iconImageHref: '/ico/man.png',
|
||||||
|
iconImageSize: [32, 37]
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}, function(){
|
||||||
|
userLat = ymaps.geolocation.latitude;
|
||||||
|
userLng = ymaps.geolocation.longitude;
|
||||||
|
|
||||||
|
myMap.geoObjects.add(
|
||||||
|
new ymaps.Placemark(
|
||||||
|
[userLat, userLng],
|
||||||
|
{
|
||||||
|
balloonContentHeader: ymaps.geolocation.country,
|
||||||
|
balloonContent: ymaps.geolocation.city,
|
||||||
|
balloonContentFooter: ymaps.geolocation.region
|
||||||
|
},
|
||||||
|
{
|
||||||
|
iconImageHref: '/ico/man.png',
|
||||||
|
iconImageSize: [32, 37]
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue