0

I have a div containing a google map and another div containing a set of entries with a scroll bar. I want to be able to click on a marker that appears on the map, and have the set of entries scroll to the entry associated with the clicked marker.

However, I keep getting an o is undefined error. I'm not sure how to do it another way besides the following:

I tried doing it this way:

$('.an_entry').each(function() {
  var id = $(this).attr('id');
  var lat = $(this).attr('lat');
  var lng = $(this).attr('lng');
  latlng = new google.maps.LatLng(lat, lng)
  $('#map').gmap('addMarker', {'position': latlng, 'bounds':true})
    .click(function() {
      $('#sideBar').scrollTo('#'+id);
    });
  });

1 Answers1

0

I see that lat_pt and lng_pt are not defined. Should be lat and lng.

latlng = new google.maps.LatLng(lat, lng)
Sam Tyson
  • 4,496
  • 4
  • 26
  • 34
  • sorry that was a typo. The markers are rendered on the map, so I know that isn't the problem. I still get the 'o is undefined' error. – user1370325 May 02 '12 at 15:57