javascript - link outside google maps to center map on marker -


I have a Google Map with many markers, outside the map, there is a list of markers displayed on the map. I want to be able to create links from this listed address, and when I click on them, then focus the map on this marker (without erasing all other markers).

Here is an example of creating a link as you add the marker to the center in Google Maps v3 :

add code (MyMap, myAddress, myLat, myLng) {// Google Map LatLng to create myLatLng = new google.maps.LatLng (myLat, myLng) from the status; // marker var myMarker = create new google.maps.marker ({map: myMap location: myLatLng}); // Create a new anchor, click, and container $ ("& lt; a & gt; & lt; / a & gt;") .attr ("href", "#"). Click Html (myAddress). Click (function) {MyMap.setCenter (myLatLng);}) .appendTo (". MyLinkContainer"); }

This is probably the best that you do this when creating a marker, so you should keep the reference of the LatLng object that defines the position in the window No need -Livel object

Comments