Hello

I am trying to create a script that shows some markers and
automatically zooms in the map area showing all of them. I tried using
suggested scripts i found here (using bounds) but there is no luck.

This is my script, can someone help me on this?

thanks in advance!


<script type="text/javascript" src="http://maps.google.com/maps/api/js?
sensor=false"></script>

 <script type="text/javascript">
                        function initialize()
{


var latlng = new google.maps.LatLng(38.379, 23.858);
var options = {
 zoom: 7,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP,
scrollwheel: false,
navigationControlOptions: {
style: google.maps.NavigationControlStyle.ZOOM_PAN
}
};

var map = new google.maps.Map(document.getElementById('map'),
options);
var bounds = new google.maps.LatLngBounds();
var infowindow = new google.maps.InfoWindow({
                                maxWidth: 300
                                        });

var marker160 = new google.maps.Marker({
            position: new google.maps.LatLng(38.622070, 21.401182),
            map: map,
            title: 'title1',
            clickable: true,
            icon: 'img/special.png'
                        });

bounds.extend(38.622070, 21.401182);

google.maps.event.addListener(marker160, 'click', function() {
                          infowindow.setContent('<p align=left 
class=smalltext>text</p>');
 infowindow.open(map,marker160);
                        });

var marker376 = new google.maps.Marker({
            position: new google.maps.LatLng(38.394374, 21.425970),
            map: map,
            title: 'text2',
            clickable: true,
            icon: 'img/special.png'
                        });

bounds.extend(38.394374, 21.425970);

google.maps.event.addListener(marker376, 'click', function() {
infowindow.setContent('<p align=left class=smalltext>test</p>');
infowindow.open(map,marker376);
});

var marker380 = new google.maps.Marker({
 position: new google.maps.LatLng(38.423470, 21.759109),
 map: map,
title: 'text3',
clickable: true,
icon: 'img/special.png'
});

bounds.extend(38.423470, 21.759109);

google.maps.event.addListener(marker380, 'click', function() {
infowindow.setContent('<p align=left class=smalltext>testt</p>');
infowindow.open(map,marker380);
});

map.fitBounds(bounds);
}

</script>

</HEAD>
<BODY onload="initialize();">

--

You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-maps-js-api-v3?hl=en.


Reply via email to