【发布时间】:2011-05-23 21:20:39
【问题描述】:
我的谷歌地图实例中的信息窗口看起来很有趣:
构成信息窗口图形角落和末端的某些图像似乎丢失了。知道为什么会这样吗?我正在尝试,但还没有弄清楚。
我正在使用gmap3,这是 google 的 V3 API 的 JQuery 包装器。这是我设置地图的代码(javascript/haml):
<script>
$(window).load(function() {
$('#map').gmap3();
var bounds = new google.maps.LatLngBounds ();
-@areas.each do |area|
bounds.extend(new google.maps.LatLng(#{area.latitude}, #{area.longitude}));
$('#map').gmap3(
{
action:'addMarker',
latLng:[#{area.latitude},#{area.longitude}],
events:{click:function(marker, event){
$(this).gmap3({action:'clear',list:['infoWindow']});
$(this).gmap3(
{
action:'addInfoWindow',
latLng:marker.getPosition(),
infowindow:
{content:"#{escape_javascript(link_to area.name, area)}<br>#{escape_javascript(image_tag area.image_holder.image.url(:thumb)) if area.image_holder.present?}"}
}
)}}
}
);
$('#map').gmap3('get').fitBounds(bounds);
$('.clickable_row').click(function() {
var id = $(this).attr('id');
window.location = '#{areas_path}' + '/' + id;
});
});
</script>
【问题讨论】:
-
尝试在 Google 地图论坛上提问:groups.google.com/group/google-maps-api/topics?pli=1
-
你能分享你的代码和/或行为不端的应用程序的链接吗?
-
另外,这是 Google Maps API v2 还是 v3? (仅供参考,@AR 提供的链接是针对 v2 论坛的。)
-
这是 V3。我会补充这个问题。
标签: ruby-on-rails google-maps jquery-gmap3