Google Maps API v3控件显示在地图后面
Google Maps API v3 controls showing up behind map
问候&你好,
这是我第一次使用谷歌地图API,我正在使用WordPress和Genesis框架,
我正在学习关于……的教程http://tympanus.net/codrops/2011/04/13/interactive-google-map/
我已经得到了一个谷歌地图显示在地图页面,
http://www.foodtrucksnashville.com/map/然而,你会注意到地图控件在地图的下面。嗯。不知道。需要帮助/指引方向
再次感谢stackoverflow社区。
下面是init.js中的代码:var map, geocoder, marker, ey, my, mouseDown = false;
var o = {
init: function () {
this.map.init();
},
map: {
size: function () {
// so it's a loverly sqware.
var w = jQuery('.content-sidebar #content').width(),
h = 440;
return {
width: w,
height: h
}
},
data: {
zoom: 13,
center: new google.maps.LatLng(36.165389, -86.783237), // Nashville TN Capitol BLDG
scrollwheel: false,
mapTypeId: google.maps.MapTypeId.ROADMAP
},
init: function () {
// get the map size
var size = o.map.size();
// add some css to the #map div based on the size
jQuery('#map').css({
width: size.width,
height: size.height,
});
// make a new google map in the #map div and pass it the map data
map = new google.maps.Map(document.getElementById('map'), o.map.data), geocoder = new google.maps.Geocoder();
/*
// add eventlistener to map to hide posts when dragging?
google.maps.event.addListener(map, 'dragstart', function () {
jQuery('.posts').hide();
});
*/
}
} // end map
} // end o object
jQuery(window).load(function () {
o.init();
});
我的问题来自我的css文件上的z-index。我试着一个一个地禁用,直到我找到它。
figure.rounded img {
width: 100%;
z-index: -1; /* Here he is */
position: relative;
-webkit-border-radius: 8px;
-moz-border-radius: 8px;
border-radius: 8px;
}
终于弄明白是怎么回事了,在google Maps API v3的群组中找到了解决方案,
http://code.google.com/apis/maps/documentation/javascript/forum.html?place=topic%2Fgoogle-maps-js-api-v3%2F8dOLhjNQzmo%2Fdiscussion在我的子主题中隐藏了一些CSS属性,这些属性针对的是一些max-width: 100%的图像。
一旦我用max-width删除了所有针对img元素的引用,生活又开始了。
相关文章:
- 张贴到地图显示的限制
- 谷歌地图显示灰色方框
- 无法让谷歌地图显示在我的网站上
- Google Maps Javascript API v3 地图显示在桌面浏览器上,但不会显示在移动浏览器上
- 双击谷歌地图显示提示框不起作用
- 谷歌地图显示钦奈(印度)使用javascript
- 使用 IMG 地图显示更大的图像
- 当缩放级别为 1 时,谷歌地图显示 kml(内部是图像 URL)不正确
- 无法让我的 openlayers 地图显示在网页上
- 谷歌地图显示没有jQuery
- 谷歌地图显示问题
- 谷歌/必应地图显示所有城市
- Esri 地图显示信息窗口,无需单击地图
- 必应地图显示地图的左上角的北美
- 谷歌地图显示KML数据
- 谷歌地图显示新请求后的旧方向
- 谷歌地图显示什么,直到我最小化屏幕
- 谷歌地图显示多个地图而不是一个
- 为什么谷歌地图显示灰色,而没有初始化缩放&当使用jQuery按钮更改缩放时,居中,地图上的居中效果非常好
- 谷歌地图显示标题的信息框