【发布时间】:2015-01-23 06:31:26
【问题描述】:
好吧,我正在尝试将谷歌地图放入引导模式,但地图上的图像看起来不适合下载或不适合, 这是我的 js 代码:
Template.map_template.rendered = function (){
Tracker.autorun(function () {
initialize();
});
};
function initialize() {
var mapOptions = {
center: new google.maps.LatLng(51.219987, 4.396237),
zoom: 12,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map_canvas"),
mapOptions);
Tracker.autorun(function () {
$('#map-modal').on('shown.bs.modal', function() {
console.log("Se corre esta funcion")
var currentCenter = map.getCenter(); // Get current center before resizing
google.maps.event.trigger(map, "resize");
map.setCenter(currentCenter); // Re-set previous center
});
});
}
这是我的模板:
<template name="map_template">
<div id="map_canvas">
</div>
</template>
我试着把它放在我的 css 上,
#map_canvas img {
max-width: none;
vertical-align: baseline; }
#map_canvas {
max-width:600px;
height: 200px;}
实际上我几乎尝试了所有方法,如果 boostrap.css 或 bootstrap.js (Bootstrap 3) 上有我需要删除或更改的内容,但我的地图如下所示:
希望大家能帮帮我,谢谢!
【问题讨论】:
-
没有 max-width 可以正常工作吗?
-
不,兄弟,它没有,谢谢
标签: javascript css twitter-bootstrap google-maps meteor