我正在使用“ Gmap3” Jquery插件,并且尝试仅初始化街景,而没有街景和路线图的组合,也无法在街景和地图之间切换。 Gmap3在其文档(http://gmap3.net/api/set-street-view.html)中仅包含以下两个示例:
显示路线图和街景:
var fenway = [42.345573,-71.098326];
$('#test1').gmap3(
{ action:'init',
zoom: 14,
mapTypeId: google.maps.MapTypeId.ROADMAP,
streetViewControl: true,
center: fenway
},
{ action:'setStreetView',
id: 'test1-streetview',
options:{
position: fenway,
pov: {
heading: 34,
pitch: 10,
zoom: 1
}
}
});
或在路线图和街景视图之间切换:
$('#test2').gmap3({
action:'init',
zoom: 18,
mapTypeId: google.maps.MapTypeId.ROADMAP,
streetViewControl: false,
center: [40.729884, -73.990988]
});
$('#test2-toggle').click(function(){
$('#test2').gmap3({
action:'getStreetView',
callback:function(panorama){
var visible = panorama.getVisible();
if (visible) {
panorama.setVisible(false);
} else {
var map = $(this).gmap3('get');
panorama.setPosition(map.getCenter());
panorama.setPov({
heading: 265,
zoom:1,
pitch:0}
);
panorama.setVisible(true);
}
}
});
});
但很抱歉,我尝试了一下,但找不到有效的解决方案,即如何仅在div #streetview中初始化街景。
非常感谢您的帮助,在此先感谢您!
最佳答案
老实说,我不知道这个jquery插件,但是您刚刚使用Maps API尝试了吗?
https://developers.google.com/maps/documentation/javascript/streetview
https://google-developers.appspot.com/maps/documentation/javascript/examples/streetview-embed
关于jquery - GMap:仅初始化街景 View (无路线图),我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/10295838/