Closed cagdasolgun closed 12 years ago
You're probably looking for JS example, but here's how I added a listener with CoffeeScript:
In my view:
<% content_for :scripts do %>
<%= coffee_script_tag do %>
GmapsHelper.setCallbackHandlers()
<% end %>
<% end %>
In gmaps_helper.js.coffee:
class @GmapsHelper
@setCallbackHandlers: ->
Gmaps.map.callback = ->
google.maps.event.addListener Gmaps.map.serviceObject, "click", doSomething
doSomething = ->
# do whatever with the Gmaps.map object.
Hope that helps.
@nithinbekal Your example is really nice, thanks for sharing.
I guess this would ideally deserve some wiki entry to inspire more people
Hi;
is there any examples or demp about adding event handlers like click to somewhere on map. Already checked
http://stackoverflow.com/questions/5593718/googlemap-handle-event-in-rails/5594602#comment14883527_5594602
and
http://stackoverflow.com/questions/6735056/rails-3-gmaps4rails-clicking-on-the-map/6738675#comment14885878_6738675
Didn't worked for me.