我想为我想要的标记创建一个带有 jquery 的弹出窗口。所以我有一个标记的代码,但是如何为另一个标记创建另一个弹出窗口?例如在标记巴黎。我也想知道如何防止弹出窗口移动?
<script type='text/javascript'> $(function(){function initialize() {
var mapOptions = {
zoom: 4,
disableDefaultUI: true,
center: new google.maps.LatLng(45.35, 4.98),
mapTypeId: google.maps.MapTypeId.TERRAIN
}
var map = new google.maps.Map(document.getElementById('map_canvas'),
mapOptions);
// Paris
var Paris = new google.maps.LatLng(48.856291,2.352705);
var image = 'rss.png';
var marker = new google.maps.Marker({
position: Paris,
map: map,
icon: image,
});
// Le Mans
var Lemans = new google.maps.LatLng(48.006922,0.20874);
var image = 'rss.png';
var marker = new google.maps.Marker({
position: Lemans,
map: map,
icon: image,
});
var styles = [
{
featureType: "all",
stylers: [
{ saturation: -15 },
{ lightness: -10 },
]
},
];
map.setOptions({styles: styles});
var popup=$('<div/>', {
'id':'infoWindow',
'text':'Hello World'
}).dialog({
'autoOpen':false,
'width': 200,
'height':200,
'resizable':false,
'modal':true,
'title':'Map info'
});
google.maps.event.addListener(marker, 'click', function(e) {
console.log(e);
popup.dialog('open');
}); }initialize();}); </script>