Google Maps跳至

Complete novice question but I cannot work out how to do this:

http://www.warrensbakery.co.uk/plymouth.htm

I want to create a map with links that jump to the correct pin on the google map and shows the address.

Thank you in advance

I made a custom Google Maps map with several locations, each you could click on the pin itself on the map and a infowindow would open. I also wanted what I believe you're talking about - the ability to click a link outside of the map and have a particular pin's infowindow open on the map. It's actually quite easy - just set the click event to the same open infowindow event the pin has.

Relevant JavaScript

/* Used variables
  map = the map itself
  marker = the current pin
  infowindow = the infowindow shown on the map
    - my setup has only one infowindow and clicks just swap its content
  label = the current infowindow content
*/


// Inside loop setting each pin to the map

// Click mevent for pins
google.maps.event.addListener(marker, 'click', function() {
    infowindow.close;
    infowindow.setContent(label);
    infowindow.open(map,marker);
});

// Click event for link outside the map
$(relevantLink).click(function(){
    $("html, body").animate({scrollTop:$("#yourMap").offset().top}, 500);
    infowindow.close();
    infowindow.setContent(label);
    infowindow.open(map,marker);
    return false;
});