开发者

Rails 3 gmaps4rails (clicking on the map)

开发者 https://www.devze.com 2023-03-21 16:25 出处:网络
Im trying to do a click on map that shows some info. Im using google API\'s Gmaps4Rails.callback = function() {

Im trying to do a click on map that shows some info. Im using google API's

Gmaps4Rails.callback = function() {
google.maps.event.addListener(map, "click", function开发者_运维百科() {
alert("You clicked the map.");
});
};

but this is not working, It doesnt no anything


You're simply not getting the map object properly: it's stored in the Gmaps4Rails namespace:

Gmaps4Rails.callback = function() {
  google.maps.event.addListener(Gmaps4Rails.map, "click", function() {
    alert("You clicked the map.");
  });
};
0

精彩评论

暂无评论...
验证码 换一张
取 消