2

場所の選択画面に googlemaps v3/ASP.net MVC/Knockout を使用しています。情報ウィンドウにストリートビュー画像が表示されません。私はいくつかの異なる例を試しました。画像がプルダウンされていることはわかりますが (ブラウザー リソースで表示可能)、表示されません。

誰かが私が見逃しているものを見ていますか? 本当にうまくいくようです。「リソースはイメージとして解釈されましたが、MIME タイプのアプリケーション/オクテットストリームで転送されました」という警告が表示されますが、前述のように、イメージがブラウザに送信されていることがわかります。

  // 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>
4

1 に答える 1