Изменение координат в урле, обработка пришедших координат

This commit is contained in:
Krivchikov Dmitry 2014-05-03 18:57:03 +04:00
parent d625dbfe59
commit 57a93f1c1f
1 changed files with 10 additions and 1 deletions

View File

@ -50,6 +50,12 @@ function init() {
} }
}); });
myMap.events.add('boundschange', function(e){
if (!myMap.balloon.isOpen()) {
history.pushState({}, document.title, "/?lat="+e.get('newCenter')[0]+"&lng="+e.get('newCenter')[1]+"&zoom="+e.get('newZoom'));
}
});
im = new ymaps.Placemark( im = new ymaps.Placemark(
[ymaps.geolocation.latitude, ymaps.geolocation.longitude], [ymaps.geolocation.latitude, ymaps.geolocation.longitude],
{ {
@ -103,6 +109,9 @@ function getPoints()
if (getURLParameter('point') != 'null') if (getURLParameter('point') != 'null')
{ {
showInfo(getURLParameter('point')); showInfo(getURLParameter('point'));
} else if ( (getURLParameter('lat') != 'null')&&(getURLParameter('lng') != 'null')&&(getURLParameter('zoom') != 'null') )
{
myMap.setCenter([getURLParameter('lat'), getURLParameter('lng')], getURLParameter('zoom'));
} }
} }
}); });