1
我目前正在隐藏标签系统中使用谷歌地图。所有工作正常,除了地图似乎偏离中心,我不得不滚动找到我的标记。谷歌地图调整大小和集中在标签系统
我设法得到完整的地图加载,因为之前只有一部分地图因隐藏属性而可见。
我已经使用了下面的脚本,但在尝试使用.getCenter集中地图时,收到Javascrip错误“Object#has no method'getCenter'”。
<script type="text/javascript">
$(document).ready(function(){
$('#hotel-listing .option').hide();
$('#hotel-listing .option:first').show();
$('#hotel-listing nav ul li a:first').addClass('active');
$('#hotel-listing nav ul li a').click(function(){
$('#hotel-listing nav ul li a').removeClass('active');
$(this).addClass('active');
var currentTab = $(this).attr('href');
$('#hotel-listing .option').hide();
$(currentTab).show();
var currCenter = map.getCenter();
google.maps.event.trigger(map, 'resize');
map.setCenter(currCenter);
return false;
});
});
</script>
任何帮助赞赏。
感谢