Поиск по адресу

This commit is contained in:
Krivchikov Dmitry 2014-04-09 12:21:48 +04:00
parent 396f9d0921
commit 049c877af5
2 changed files with 13 additions and 2 deletions

View File

@ -2,9 +2,9 @@
<div id="footer">
<div class="col-lg-3">
<div class="input-group">
<input type="text" class="form-control" placeholder="Поисл на карте...">
<input type="text" id="addressField" class="form-control" placeholder="Поисл на карте..." onkeydown="if(event.keyCode == 13) {searchAdderess()}" />
<span class="input-group-btn">
<button class="btn btn-default" type="button"><span class="glyphicon glyphicon-search"></span></button>
<button class="btn btn-default" type="button" onclick="searchAdderess()"><span class="glyphicon glyphicon-search"></span></button>
</span>
</div>
</div>

View File

@ -91,3 +91,14 @@ function initCategories()
return true;
}
function searchAdderess()
{
var myGeocoder = ymaps.geocode($('#addressField').val());
myGeocoder.then(
function (res) {
myMap.setCenter(res.geoObjects.get(0).geometry.getCoordinates(), 13);
},
function (err) {}
);
}