0
jQuery UIダイアログにGoogleマップが埋め込まれています。Googleマップを使用したjQuery UIダイアログは一度しか動作しません
期待どおりに動作しますが、ページがリフレッシュされるまで1回だけ動作します。ここで
は何が起こるかです:(!パブロダルの)リンク上
- ユーザーがクリックすると、ポップアップが開き、マップ
- ロードされているユーザーは、ユーザーがクリックポップアップ
- を閉じ再びリンク:ポップアップが開き、左下に「Google」と表示されますが、地図の領域は空のままです。
- ユーザーがページを更新し、すべて正常に戻る です。これは、Googleの最後にはいくつかの制限ではないか、私のコードに何か問題がある場合、私は疑問に思う
$(document).ready(function() { //avoid conflict with bootstrap css tooltips var bootstrapButton = $.fn.button.noConflict(); $.fn.bootstrapBtn = bootstrapButton; //button click event handler $("#popMap").click(function (ev) { //create map to draw address location var pavlodar = {lat: 52.3200561, lng: 76.9082336}; var map = new google.maps.Map(document.getElementById('mapcanvas'), { zoom: 18, center: pavlodar, mapTypeId: google.maps.MapTypeId.ROADMAP }); //establish ideal sizes var w = screen.width; var h = screen.height; if(w > h){ var dw = w * 0.5; var dh = h * 0.5; } else { var dw = w * 0.8; var dh = h * 0.6; } // create the map point var marker = new google.maps.Marker({ map: map, position: pavlodar }); //calling the dialog $("#mapcanvas").dialog({ title: "наше место нахождения", maxWidth: dw, maxHeight: dh, height: dh, width: dw, modal: false, position: { my: "center", at: "center", of: window }}); //stop the browser interpreting the click ev.preventDefault(); ev.stopPropagation(); }); });
:
は、ここに私の機能です。
何が問題なのでしょうか?
を表示された後、私は、これはうまくいくかもしれない方法を見て、それは、ダイアログがあるとしてページがロードされると開いて、そこにマップはありません( – nico
'autoOpen:false'を使用します.Check [this](http://jsfiddle.net/cshudc91)) – Viney