Closed halcyonandon closed 10 years ago
Nevermind... ready did the trick... since this isn't in the example code, for anyone that may end up looking for this, my solution was as follows:
var MarkerView = Backbone.GoogleMaps.MarkerView.extend({
infoWindow: InfoWindow,
initialize: function() {
//_.bindAll(this, 'handleDragEnd');
},
mapEvents: {
ready: 'markerReady',
click: 'pinClick'
},
markerReady: function() {
// This is the equivalent of gmaps.event.addListener( spot.marker, 'ready', function(event) { ... })
var index = this.model.attributes.index;
if (!$.browser.mobile) {
// Hover function
$("#label" + index).mouseenter(function() {
$('.result').removeClass('hovered');
$(".result" + index).addClass('hovered');
});
$("#label" + index).mouseleave(function() {
$(".result" + index).removeClass('hovered');
});
}
$.wait(index*30).then(function() {
$('#label'+ index).addClass('display-pin animated bounceInDown');
});
},
but unfortunately that click event isn't triggering for some reason
One thing you may be running into is that the library is setting the mapEvents
object as a property of the MarkerView
prototype rather than of each MarkerView
instance. This can cause unwanted side effects, if any one instance changes their mapEvents
object.
I just fixed this in e8a52a5a57b6d5afc4837e270466cde7e73ddd93. You'll want to follow suit. So instead of:
var MarkerView = Backbone.GoogleMaps.MarkerView.extend({
// A single mapEvents object is assigned to MarkerView.prototype by Backbone.extend
// If this object changes, every instance of MarkerView will be effected
mapEvents: {...}
});
you'll want do this:
var MarkerView = Backbone.GoogleMaps.MarkerView.extend({
initialize: function() {
// Every instance gets its own version of the mapEvents object
this.mapEvents = { ... }
}
});
I hope that helps.
Hi, I'm using richmarker, but instead of setting the visibility of the pin, I'm adding classes. The purpose of this is to use css transitions for the drop in effect.
Where is the appropriate place to do this? is this onRender?