2

おい!


Google Maps API v2(何らかの理由でv2である必要があります)とjQuery UI 1.8.6(およびjQuery 1.4.1)を使用してます。

状況は次のとおり です。モーダルダイアログ内にマップがあります。

問題は次のとおりです。 情報「バルーン」の影をクリックして地図をドラッグしても、ドラッグが停止しません。

どのコードを提供すればよいか本当にわからないので、コードを具体的に入れてほしい場合は、私に知らせてください。

function createMarker(latitude, longitude, num, color, id_local) {

var iconOptions = {};
iconOptions.width = 32;
iconOptions.height = 32;
iconOptions.primaryColor = ''+color;
iconOptions.label = ''+num;
iconOptions.cornerColor = "#82c4e8";
iconOptions.strokeColor = "#000000";

var newIcon = MapIconMaker.createLabeledMarkerIcon(iconOptions);
//
var point = new GLatLng(latitude,longitude,0);
//
var marker = new GMarker(point, {
    icon: newIcon
});


var html = $('#info_mapa_'+id_local).html();
GEvent.addListener(marker, 'click', function() {
    marker.openInfoWindowHtml(html);
});

return marker;
}


ありがとうございました。

4

2 に答える 2

0

上司は、v3への移行に1日を費やして、このばかげた問題を取り除くことにしました。みんなありがとう。

于 2011-03-21T23:28:33.893 に答える
0

アップデート

デモ: http://jsbin.com/ofuze4

デモ: https://so.lucafilosofi.com/google-maps-api-v2-jquery-ui-dialog-non-stoppable-dragging-problem/

疑似コード:

JS:

$(function() {
    $("#j-dialog").dialog({
        resizable: false,
        width: 500,
        height: 400,
        open: function() {
            initialize();
        }
    });
});
function initialize() {
    var latlng = new google.maps.LatLng( - 34.397, 150.644);
    var myOptions = {
        zoom: 8,
        center: latlng,
        mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    var map = new google.maps.Map($("#map_canvas")[0], myOptions);

    var contentString = $('#map-info').text();

    var infowindow = new google.maps.InfoWindow({
        content: contentString
    });

var newIcon = 'http://cdn2.iconfinder.com/data/icons/oxygen/48x48/actions/note2.png';

var marker = new google.maps.Marker({ 
    icon: newIcon,
    position: latlng,
    map: map,
    title: "Hello World!"
});

    google.maps.event.addListener(marker, 'click',
    function() {
        infowindow.open(map, marker);
    });
}

CSS:

<style>#map_canvas { margin:0 auto; width:450px; height: 340px }</style>

HTML:

    <div title="google maps inside jquery dialog" id="j-dialog">    
      <div id="map_canvas">
      </div>  
    </div>

この助けを願っています

参照:

于 2010-12-23T13:23:32.117 に答える