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