I want to toggle open and close Infowindow divs on markers on my google map in a Backbone.ja app.
In my view I have an initialize function that has google.maps.event.addListener.
function initialize(viewOptions, app) {
this.app = app;
this.address = '';
this.terms = [
'Food',
'Bar'
];
// this.listenTo(this.collection, 'reset', this.render);
this.listenTo(this.collection, 'add', this.addmarker);
this.render();
google.maps.event.addListener(map, 'click', function() {
console.log('Clicked')
// infoclicker.call();
});
};
This addListener does not seem to work. When I click a marker, or even just anywhere on the map it does not trigger console.log. What am I doing wrong here?
Also FYI: there is a _setMap function called by the render function, that sets the map.
function _setMap(zoom, lat, long) {
var mapOptions = {
zoom: zoom ? zoom : 15,
center: new google.maps.LatLng(lat ? lat : 45.5200,long ? long : -122.6819)
};
this.map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
};
mapin thataddListenercall? - mu is too short#map-canvaswhen you call_setMap? - mu is too shortdocument.getElementById('map-canvas')is returning what you expect it to? - mu is too short