Closed mjohnst closed 10 years ago
Just taking relevant code, this works fine for me:
create_infowindow: ->
return null unless _.isString @args.infowindow
boxText = document.createElement("div")
boxText.setAttribute("class", 'yellow') #to customize
boxText.innerHTML = @args.infowindow
$(boxText).on 'click', -> console.log('foo')
@infowindow = new InfoBox(@infobox(boxText))
A custom InfoBox won't allow the elements inside it to listen for a .on('click') event.
Created these markers with a link as the text.
Created a custom InfoBox as per the code here: https://github.com/apneadiving/Google-Maps-for-Rails/wiki/Change-handler-behavior
Built the map:
And added this handler:
The handler won't fire when the link is clicked.
Also, if I add the handler in the developer console after the link has been added to the DOM, it won't work with:
but will work with
handler.
The custom InfoBox seems to prevent just .on events from firing.