我正在使用googlemaps v3/ASP.net MVC/Knockout作为位置选择屏幕。 infowindow中无法获取街景图片。我已经尝试了几个不同的例子。我可以看到图像被拉下(在浏览器资源中可见),但不会显示。在infowindow中嵌入街景图片 - Google地图v3
有没有人看到我失踪的东西?它真的好像应该工作。我确实收到了关于“资源解释为图像但是使用MIME类型application/octet-stream传输”的警告,但正如我所说的,我可以看到将图像传送给浏览器。
// Function for creating a marker and adding to myMarkers array
function addMarker(location, id) {
var selector = "#hiddenBranch" + id;
var html = $(selector)[0].innerHTML;
var panSelector = "PanId" + id;
var marker = new google.maps.Marker({
position: location,
distance: google.maps.geometry.spherical.computeDistanceBetween(location, centerCoords),
});
marker.setValues({id: id})
google.maps.event.addListener(marker, "click", function() {
if (infowindow) infowindow.close();
infowindow = new google.maps.InfoWindow({
content: ''
});
infowindow.setContent(html);
infowindow.open(map, marker);
var panoramaOptions = {
position: location,
pov: {
heading: 34,
pitch: 10,
zoom: 1
}
};
var pano = null;
google.maps.event.addListener(infowindow,'domready', function() {
pano = new google.maps.StreetViewPanorama(document.getElementById(panSelector), panoramaOptions);
pano.bindTo("position", marker);
pano.setVisible(true);
});
});
myMarkers.push(marker);
}
html的部分。重复与淘汰赛。
@*The content of this div will be displayed in infowindow*@
<div style="display:none">
<div data-bind="attr: {'id': HiddenDivId}">
<div style="width:100px; height:100px" data-bind="attr: {'id': HiddenPanDivId}">
</div>
<input data-bind="value: Id" class="hiddenBranchId" type="hidden" value="">
<input data-bind="value: DirectionLink" class="hiddenDirectionLink" type="hidden" value="">
<ul>
<li><h2></h2></li>
<li data-bind="text: BranchName"></li>
<li data-bind="text: StreetAddress"></li>
<li><span data-bind="text: City"></span>, <span data-bind="text: Zip"></span> <span data-bind="text: State"></span></li>
<li><a href='#' class="branchSelectLink" onclick=selectBranch(this)>Select</a> | <a href="#" onclick=openDirectionWindow(this)>Directions here</a></li>
</ul>
</div>
</div>
你放置街景的div的大小是多少?不知道它是否会有所帮助,但是,[在infowindows中使用Streetview的工作示例](http://www.geocodezip.com/v3_StreetViewInInfoWindowB.html) – geocodezip 2013-02-13 00:15:36