链接到Google Maps Streetview时摆脱边栏 [英] Get rid of sidebar when linking to Google Maps Streetview
问题描述
我正在使用v3地图JS API google.maps.getPanoramaByLocation来创建包含经纬度的街景链接,如下所示: http://maps.google.com/?cbll=52.099659,0.140299&cbp=12,0 ,, ,& layer = c ,但是我想知道是否有人知道如何摆脱默认情况下出现在街景视图中的大型左侧边栏?我已经检查过 mapki ,但没有骰子.
I'm using the v3 maps JS API google.maps.getPanoramaByLocation to create a link to streetview with lat/lng which looks like: http://maps.google.com/?cbll=52.099659,0.140299&cbp=12,0,,,&layer=c, but I was wondering if anyone knew how to get rid of the large left-hand sidebar that appears in street view by default? I've checked mapki but no dice.
推荐答案
请考虑以下示例.它使用getPanoramaByLocation()
方法,并且不呈现左侧边栏:
Consider the following example. It uses the getPanoramaByLocation()
method, and does not render a left sidebar:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>Google Maps API v3 - Street View Demo</title>
<script src="http://maps.google.com/maps/api/js?sensor=false"
type="text/javascript"></script>
</head>
<body>
<div id="pano" style="width: 400px; height: 300px;"></div>
<script type="text/javascript">
var panorama = new google.maps.StreetViewPanorama(
document.getElementById('pano')
);
var sv = new google.maps.StreetViewService();
sv.getPanoramaByLocation(
new google.maps.LatLng(42.345573,-71.098326),
50,
function (data, status) {
if (status == google.maps.StreetViewStatus.OK) {
panorama.setPano(data.location.pano);
panorama.setPov({ heading: 270, pitch: 0, zoom: 1 });
panorama.setVisible(true);
}
}
);
</script>
</body>
</html>
屏幕截图:
这篇关于链接到Google Maps Streetview时摆脱边栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!