Cha*_*zak 4 google-maps ruby-on-rails jquery-gmap3
我的谷歌地图实例中的信息窗口看起来很有趣:
构成信息窗口图形的角落和四肢的一些图像似乎缺失.知道为什么会这样吗?我正在试验,但尚未弄明白.
我正在使用gmap3,一个用于谷歌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>
Run Code Online (Sandbox Code Playgroud)
Joe*_*ham 11
我已经看到这是由最大宽度规则覆盖地图引起的.尝试设置:
#map img { max-width: none; }
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1338 次 |
| 最近记录: |