Adam, please take Pil's above suggestion:
a) Put your infoWindow variable and call to the Google Maps ONCE as
global (outside your functions, in the your maps.js script and, of
course, after the Google Maps initialization function). This is
because you don't need to call it for every marker.
Example:
var infoWindow = new google.maps.InfoWindow();
b) Clean your infowindow declarations locally in all your functions,
and use the method "setContent" to put HTML into the window looping
across your array. Do this inside the listener function of every
marker:
Example:
google.maps.event.addListener(marker, 'click', function() {
infowindow.setContent(contentString);
infowindow.open(map, marker);
});
c) To remove the last and unique infowindow you need to use a method
"close()" before to call a new set of markers by selecting another
category:
Example:
infoWindow.close()
Let me know if this helps better. Also let me know if you are
interested in make Open Source your Joomla component, I can help
better to make it progress if you decide to open the extension as a
GPL project.
Regards,
Martin
On 24 mayo, 17:37, Adam Schulz <
aschul...@gmail.com> wrote:
> Martin,
> Thanks for your suggestion, I absolutely will be taking your advice.
> The problem that is still really bothering me is I cannot manage to close
> these info windows when I click on a different one. the infowindow.close()
> does not seem to exist. can someone please look at the source and tell me
> why the infowindow.close() has no effect.
>
> On Mon, May 24, 2010 at 4:28 PM, Martin Revert <
martinrev...@gmail.com>wrote:
>
>
>
> > Hi Adam:
>
> > Allow me to suggest that is better to implement in Joomla backend a
> > CRUD to store lat & lng in MySQL.
> > Using intensively the Geocoder like you do throws a lot of
> > OVER_QUERY_LIMIT errors because you're making a request for every
> > marker to the geocoder API.
>
> > Hope this helps.
>
> > Martin
>
> > On 24 mayo, 15:31, Pil <
wolf...@gmail.com> wrote:
> > > Seems you want the v2 behaviour back so that only one infowindow may
> > > be opened.
>
> > > If you want that, one possibility would be to define your infowindow
> > > in global scope. Before an infowindow is opened you may call
>
> > > infowindow.close();
>
> > > Then get its new content and open only the appropriate one
>
> > > infowindow.setContent("your new content");
> > > infowindow.open(map, marker);
>
> > > On May 24, 7:10 pm, Adam <
aschul...@gmail.com> wrote:
>
> > > > Hi, I'm currently working on:
> >
http://test.durham.nh.us/(deleteparenthesis<
http://test.durham.nh.us/%28deleteparenthesis>'
> > and what's in here)
> > > > index.php?option=com_maps&Itemid=58
>
> > > > The program does the following (you can prob. skip the part):
> > > > grabs a list of businesses from a MySQL table and adds them to two
> > > > arrays...One array is catbus[categoryname][counter] = individual
> > > > business names. the other is busfield[name][fields]. Each time the
> > > > drop down list is changed the map is initialized again (this is bad
> > > > but I don't know how to clear and delete markers any other way) the
> > > > addresses of each business are geocoded and placed on the map. and a
> > > > side list is made.
>
> > > > Problem: I can't figure out how to close already open infoboxes. Do I
> > > > have to loop through an array of open one's? if so...how do I do that.
>
> > > > To view the problem in action go to the link and select something like
> > > > "Business Services" from the drop down. Click on multiple items and
> > > > you will see each individual box will remain open.
>
> > > > --
> > > > 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
> >
google-map...@googlegroups.com.
> > > > To unsubscribe from this group, send email to
> >
google-maps-js-a...@googlegroups.com<
google-maps-js-api-v3%2Bunsu...@googlegroups.com>
> > .
> > > --
> > > 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
> >
google-map...@googlegroups.com.
> > > To unsubscribe from this group, send email to
> >
google-maps-js-a...@googlegroups.com<
google-maps-js-api-v3%2Bunsu...@googlegroups.com>
> > .
> > --
> > 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
> >
google-map...@googlegroups.com.
> > To unsubscribe from this group, send email to
> >
google-maps-js-a...@googlegroups.com<
google-maps-js-api-v3%2Bunsu...@googlegroups.com>
> > .