【发布时间】:2016-03-20 07:39:08
【问题描述】:
我什至想根据下拉更改更改地图标记位置,我正在做的是我在下拉事件中得到 lat,long 并想将这些坐标传递给我当前的标记,这是我的代码
$("#location").change(function () {
var addr = ($('#location').val());
var geocoder = new google.maps.Geocoder();
geocoder.geocode({ 'address': addr }, function (results, status) {
if (status == google.maps.GeocoderStatus.OK) {
alert("location : " + results[0].geometry.location.lat() + " " + results[0].geometry.location.lng());
geoMarker.setMarkerOptions({
duration: duration,
easing: $('#easingOption').val()
});
} else {
alert("Something got wrong " + status);
}
});
});
HTML:
<select id="location">
<option>Dubai</option>
<option>Sharjah</option>
</select>
它会提醒当前坐标,但我需要知道如何将这些坐标传递到我的标记位置
【问题讨论】:
-
geoMarker是什么? -
请提供一个Minimal, Complete, Tested and Readable example 来证明您的问题。
标签: javascript jquery html google-maps google-maps-api-3