javascript - How to find a certain marker on Google Map? -


i have table search results , array of markers results. every element has id, , if user clicks on marker, page scrolls search result (i'm changing window.location.hash).

is possible vice-versa? users click on search result , infowindow marker appears.

i assume mean in map marker associated search result scrolls view?

as long search result has click event contains unique identifier marker want appear, sure work. site i'm managing has sidebar of search results when click result scroll marker view on map , show infowindow. code invoked click handler looks (sans error handling , other uninteresting parts question):

function markerzoomto(markeridentifier) {     pt = gmarkers[markeridentifier].getposition();     newpt = new google.maps.latlng(pt.lat() + .02, pt.lng());     map.panto(newpt);      if (infowindow) {     infowindow.close();     }      infowindow.setcontent(gmarkers[markeridentifier].get('iwcontent'));     infowindow.setposition(gmarkers[markeridentifier].getposition());      infowindow.open(map, gmarkers[markeridentifier]); } 

i pass unique marker identifier function, specific marker out of marker array, it's lat/lng position, create latlng object, , pan location.

the rest dressing retrieve content infowindow , set it's position way see fit.

and finally, open infowindow marker.

good luck!


Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -