Answer the question
In order to leave comments, you need to log in
How to make dot move and popup?
Hello, I'm racking my brains on how to make the select redirect to the dot and popup popup
new google.maps.Marker({
position: {lat: 53.877805, lng: 27.540712}, map: map
});
new google.maps.Marker({
position: {lat: 39.489874, lng: -8.448817}, map: map
});
new google.maps.Marker({
position: {lat: 52.519881, lng: 13.407338}, map: map
});
var geocoder = new google.maps.Geocoder();
$("#city_dropdown").change(function() {
address = $("#city_dropdown :selected")[0].text;
console.log(address)
geocodeAddress(address, geocoder, map);
});
var address = $("#city_dropdown :selected")[0].text;
geocodeAddress(address, geocoder, map);
function geocodeAddress(address, geocoder, resultsMap) {
geocoder.geocode({
'address': address
}, function(results, status) {
if (status === google.maps.GeocoderStatus.OK) {
resultsMap.fitBounds(results[0].geometry.viewport);
console.log(results[0].geometry.location.lat())
} else {
alert('Geocode was not successful for the following reason: ' + status);
}
});
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question