First of all its a solution. and dynamic means the marker will set
from the array which can carry any value. here for example i have
added this array: var locations = [
['Bondi Beach', -33.890542, 151.274856],
['Coogee Beach', -33.923036, 151.259052],
['Cronulla Beach', -34.028249, 151.157507],
['Manly Beach', -33.80010128657071,
151.28747820854187],
['Maroubra Beach', -33.950198, 151.259302]
];
but its content will dynamically assigned by the system on request.
On May 12, 4:11 am, Daniels Lee™ <[email protected]> wrote:
> Hey Behestee,
>
> I'm not sure if this is a question or a solution. Also, what do you mean by
> dynamic or multiple marker?
>
> Thanks,
>
> Dann
>
>
>
> On Fri, May 7, 2010 at 5:44 AM, Behestee <[email protected]> wrote:
> > How can add infoWindow for dyanamic and multiple maker? i have try in
> > lots of way but at last I invent a solution as given below:
>
> > function initialize()
> > {
>
> > var locations = [
> > ['Bondi Beach', -33.890542, 151.274856],
> > ['Coogee Beach', -33.923036, 151.259052],
> > ['Cronulla Beach', -34.028249, 151.157507],
> > ['Manly Beach', -33.80010128657071, 151.28747820854187],
> > ['Maroubra Beach', -33.950198, 151.259302]
> > ];
>
> > var latlng = new google.maps.LatLng(-33.890542, 151.274856);
>
> > var settings = {
> > zoom: 10,
> > center: latlng,
> > mapTypeControl: true,
> > mapTypeControlOptions: {style:
> > google.maps.MapTypeControlStyle.DROPDOWN_MENU},
> > navigationControl: true,
> > navigationControlOptions: {style:
> > google.maps.NavigationControlStyle.SMALL},
> > mapTypeId: google.maps.MapTypeId.ROADMAP
> > }
> > var map = new
> > google.maps.Map(document.getElementById("mapContainer"), settings); //
> > div id diplay map
>
> > var companyLogo = new google.maps.MarkerImage("parking.png",
> > new google.maps.Size(100,50),
> > new google.maps.Point(0,0),
> > new google.maps.Point(50,50)
> > );
> > var companyShadow = new
> > google.maps.MarkerImage("parking_shadow.png",
> > new google.maps.Size(130,50),
> > new google.maps.Point(0,0),
> > new google.maps.Point(65, 50)
> > );
> > var companyMarker=[];
> > var infowindow=[];
> > var loc=null;
> > var myLatLng=null;
> > for(var i = 0; i < locations.length; i++){
>
> > loc = locations[i];
> > myLatLng = new google.maps.LatLng(loc[1], loc[2]);
> > eval("var companyMarker"+i+" = new
> > google.maps.Marker({ position:
> > myLatLng, map: map, icon: companyLogo, shadow: companyShadow,
> > title:loc[0],zIndex: i});");
> > }
> > var a=[];
> > for(i=0;i< locations.length; i++){
>
> > google.maps.event.addListener(eval("companyMarker"+i), 'click',
> > function() {
> > var ind = $(this).attr('z-index');
> > if (infowindow[ind])
> > infowindow[ind].close();
> > eval("var infowindow"+ind+" = new
> > google.maps.InfoWindow({content:
> > locations[ind][0]});");
> > eval("infowindow"+ind).open(map,
> > eval("companyMarker"+ind));
> > });
> > }
> > }
>
> > $(document).ready( function () {
> > 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]<google-maps-js-api-v3%[email protected]>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/google-maps-js-api-v3?hl=en.
>
> --
> Daniels Lee
> Developer Programs Engineer
> Google, Inc.
> 345 Spear Street
> San Francisco, CA 94105
> 650 253 0967
>
> --
> 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
> athttp://groups.google.com/group/google-maps-js-api-v3?hl=en.
--
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.