I want to display a map with the infowindow box automatically displayed for the single marker on the page, much like http://code.google.com/apis/maps/documentation/javascript/examples/map-coordinates.html
I've tried to code a callback function to accomplish this, but it's just not working for me.
<% content_for :scripts do %>
<script type="text/javascript" charset="utf-8">
Gmaps.map.callback = function() {
if (Gmaps.map.markers.length == 1) {
var marker = Gmaps.map.markers[0];
var infowindow = marker.infowindow;
infowindow.open(Gmaps.map, marker);
}
}
</script>
<% end %>