【发布时间】:2011-07-12 13:11:53
【问题描述】:
我希望将一张地图放在另一张地图上,这样我就可以在不影响道路和标签颜色的情况下使一张“卫星视图”地图变暗。 我希望它看起来像这样: http://pixfx.at/#Map
所以我拿了他们的一些代码,让它看起来像这样:
<style type="text/css">
#map {
height:543px !important;
background-image:url(../images/background_gradient_transparent.png);
background-repeat:repeat-x;
border-top:1px solid #cccccc;
border-bottom:1px solid #666666;
margin:5px 0px 5px 0px;
overflow:hidden !important;
}
#map_canvas {
height:543px !important;
background-color:transparent !important;
overflow:hidden !important;
}
#map_canvas .terms-of-use-link {
display:none;
}
</style>
<script type="text/javascript">
var map = new GMap2(document.getElementById("map_canvas"));
map.setCenter(new GLatLng(47.254072, 11.445657), 13);
map.setMapType(G_HYBRID_MAP);
/*
map.removeMapType(G_NORMAL_MAP);
map.removeMapType(G_HYBRID_MAP);
map.removeMapType(G_SATELLITE_MAP);
map.removeMapType(G_PHYSICAL_MAP);
*/
//map.getDragObject().setDraggableCursor("move");
map.enableDoubleClickZoom();
map.enableContinuousZoom();
map.enableScrollWheelZoom();
map.enableDragging();
}
function loadScript() {
var script = document.createElement("script");
script.type = "text/javascript";
script.src = "http://maps.google.com/maps/api/js?sensor=false&callback=initialize";
document.body.appendChild(script);
jQuery('#map_canvas > div > div > div > div').each( function () {
if(jQuery(this).css('zIndex') == '0')
{
jQuery(this).find('img').each( function() {
jQuery(this).css({ opacity: '0.25' });
});
}
});
jQuery('#map_canvas > .gmnoprint').css({ display: 'none' });
}
window.onload = loadScript;
</script>
</head>
<body>
<div id="map">
<div id="map_canvas" style="width:100%; height:100%;"></div>
</div>
虽然问题是地图不显示。
【问题讨论】:
标签: javascript css google-maps-api-3