のプロパティを読み取ることができません「maxZoom」私はオプションでGoogleマップのオブジェクトを持っている:私は実行することにより、ズームレベルを変更したいマップを初期化した後Google MapsのAPI JS - MarkerClusterer - 未定義
今$(document).ready(function() {
var mapOptions = {
zoom: 4,
minZoom: 3,
maxZoom: 12,
center: new google.maps.LatLng(39.484973, -0.364126),
mapTypeControl: false,
streetViewControl: false
};
var mapElement = document.getElementById('#map');
map = new google.maps.Map(mapElement, mapOptions);
markers = [...];
markerCluster = new MarkerClusterer(map, markers, {
averageCenter: true,
styles: [{
url: '/cluster.png',
width: 64,
height: 64,
textColor: 'white',
backgroundPosition: 'center'
}]
});
...
}
:
var location = ...
map.setCenter(location); // works fine
map.setZoom(7);`,
が、私は、コンソールでエラーが発生します。
Uncaught TypeError: Cannot read property 'maxZoom' of undefined
at Ag.<anonymous> (markerclusterer.js:163)
at Object._.z.trigger (js?key=AIzaSyBpuEnTxOHtdmlMllM_Qd2SL_Q2t45o3_0:99)
at Hb (js?key=AIzaSyBpuEnTxOHtdmlMllM_Qd2SL_Q2t45o3_0:38)
at Ag._.k.set (js?key=AIzaSyBpuEnTxOHtdmlMllM_Qd2SL_Q2t45o3_0:101)
at Ag.setZoom (js?key=AIzaSyBpuEnTxOHtdmlMllM_Qd2SL_Q2t45o3_0:56)
at OfferMap.setBounds (offers_offer-map_1.js:1)
at HTMLDocument.<anonymous> (offers_trainee-offers_3.js:1)
at i (jquery.min.js:2)
at Object.fireWith [as resolveWith] (jquery.min.js:2)
at Function.ready (jquery.min.js:2)
誰もがいずれかを持っています何が起こっているのか?
UPDATE
問題は以下のコメントで述べた@geocodezipとしてのでMarkerClustererであるため、ここで私はロードスクリプトは次のとおりです。
<script type="text/javascript" src="https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/markerclusterer.js"></script>
実用的なフィドルがありますか? – Mazz
プロジェクトは、フィドルのためにコピーするには複雑すぎる、ごめんなさい:/ –
jsを '
'タグの前後に配置しましたか? – Mazz