I am developing an application that uses gmaps4rails (https://github.com/apneadiving/Google-Maps-for-Rails). I want to add an event listener to the marker so that it creates a visualization next to the map (as well as displaying an info window on the map). Is it possible to add an event listener for each marker using gmaps4rails?
相关问题
- Question marks after images and js/css files in ra
- Using :remote => true with hover event
- How do you change the color of the dotted line on
- Eager-loading association count with Arel (Rails 3
- How to specify memcache server to Rack::Session::M
相关文章
- Ruby using wrong version of openssl
- Right way to deploy Rails + Puma + Postgres app to
- AWS S3 in rails - how to set the s3_signature_vers
- Difference between Thread#run and Thread#wakeup?
- how to call a active record named scope with a str
- How to add a JSON column in MySQL with Rails 5 Mig
- “No explicit conversion of Symbol into String” for
- form_for wrong number of arguments in rails 4
Of course it's possible.
You should write your code in the
gmaps4rails_callback
javascript function to be sure it's executed when everything is setup.And then loop the
markers
js variable:Gmaps4Rails.markers
The attributes of each marker in this array are:
longitude
latitude
google_object containing the google marker
That said you can do whatever you want.
As a side note, the map is also available doing
Gmaps4Rails.map
.In general, read the
gmaps4rails.js
file, it's well documented (I hope!).EDIT:
The problem you explain in the comments is weird, it works perfectly for me when I use:
I guess you should try to use a more traditional
for
loop like: