嗨,我想要这样的功能。我创建了一个地图,但是如何通过单击标记图标打开一个对话框。
<script type="text/javascript">
initialize();
// OnLoad function ...
function initialize() {
var fenway = new google.maps.LatLng(-27,133);
var mapOptions = {
center: fenway,
zoom: 4,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
var fluster = new Fluster2(map);
var marker;
<?php $count=1;
foreach($profileinfo as $property){
$lat_val = $property->lat;
$long_val = $property->lng; ?>
<?php } ?>
// Initialize Fluster and give it a existing map
var fluster = new Fluster2(map);
var marker;
<?php $count=1;
foreach($paginate as $propert){
$lat_val = $propert->lat;
$long_val = $propert->lng;
$address1 = $propert->address.','.$propert->suburb;?>
// Create a new marker. Don't add it to the map!
marker = new google.maps.Marker({
position: new google.maps.LatLng(<?php echo $lat_val; ?>, <?php echo $long_val; ?>),
title: '<?php echo $address1; ?>'
});
fluster.addMarker(marker);
<?php
}?>
// Set styles
// These are the same styles as default, assignment is only for demonstration ...
fluster.styles = {
// This style will be used for clusters with more than 0 markers
0: {
image: 'http://gmaps-utility-library.googlecode.com/svn/trunk/markerclusterer/1.0/images/m1.png',
textColor: '#FFFFFF',
width: 53,
height: 52
},
// This style will be used for clusters with more than 10 markers
10: {
image: 'http://gmaps-utility-library.googlecode.com/svn/trunk/markerclusterer/1.0/images/m2.png',
textColor: '#FFFFFF',
width: 56,
height: 55
},
20: {
image: 'http://gmaps-utility-library.googlecode.com/svn/trunk/markerclusterer/1.0/images/m3.png',
textColor: '#FFFFFF',
width: 66,
height: 65
}
};
fluster.initialize();
}
</script>