<li data-gmapping='{"id":"m_1","latlng":{"lat":54.6747,"lng":-2.5616}, "icon":"/images/mapicons/bookstore.png" }'><span class="info-box">Reading Room / Village Hall</span></li>
$('#map_canvas').gmap().bind('init', function(ev, map) { |
$("[data-gmapping]").each(function(i,el) { |
var data = $(el).data('gmapping'); |
$('#map_canvas').gmap('addMarker', {'id': data.id, 'tags':data.tags, 'position': new google.maps.LatLng(data.latlng.lat, data.latlng.lng), 'bounds':true }, function(map,marker) { |
$(el).click(function() { |
$(marker).triggerEvent('click'); |
}); |
}).click(function() { |
$('#map_canvas').gmap('openInfoWindow', { 'content': $(el).find('.info-box').text() }, this); |
}); |
}); |
}); I'm guessing that somewhere in the $('map_canvas') call 5 lines down, I have to add something in there, but I'm not sure what. Can anyone help, please? Thanks, Tom |