I tried but it doesn't work for me. I paste my code.
//TODO: Comprobar que solo se muestra un infobox
var GM = google.maps;
var openedInfoBox;
function showInfoBox(marker){
$.getJSON('places/'+marker['id'],function(data){
var boxText = '<div class="infoBox smallBox"
id="infobox_'+marker['id']+'"><div class="infoBoxContent""> ';
boxText += "ID:"+ data['id']+"</div></div>";
if (openedInfoBox){
openedInfoBox.close() // Close other infobox, if
any
}
openedInfoBox = new InfoBox(addAttrs(["content"],
[boxText],infoBoxOpts)); //addAttrs returns a valid options literal
object
openedInfoBox.open(map, marker);
GM.event.addDomListener(openedInfoBox,'clikc',function()
{ alert('click!') }); // Dont works
//$("div.infoBoxContent").click(function()
{ alert('click!') }) // Dont works
});
}
Is this the way you suggested?
On 27 mayo, 19:09, Chad Killingsworth
<[email protected]> wrote:
> You need to use addDomListener. addListener is only for map events.
>
> Chad Killingsworth
>
> On May 27, 11:42 am, "Miguel.camba" <[email protected]> wrote:
>
>
>
> > I have the same problem. Neither my InfoBoxes nor his internal
> > elements seems to captureclickevents.
> > I tried adding a listener to theinfoboxitself:
> > var ib = newInfoBox(opts);
> > google.maps.event.addListener(ib,'click',function()
> > {alert('click!')})
> > And with JQuery on the content
> > $('#infobox_content').click(function(){ alert('click') } )
>
> > On the options i have "enableEventPropagation" : true, so i have no
> > idea what's the problem.
> > It seems like i cantclicktheinfoboxand i pass through, clicking
> > the map.
>
> > Any idea?
>
> > On 14 abr, 21:19, Daniel Lee <[email protected]> wrote:
>
> > > If you want to listen to *click* events within theInfoBox, you can
> > > probably
> > > add the listener to the HTML Node passed in as the content. Have you
> > > tried
> > > this?
>
> > > To openInfoBox, it's probably best to maintain a single global variable
> > > for
> > > which you can call anywhere. This will also ensure only a singleInfoBoxis
> > > open at any moment.
>
> > > Regarding Markers, it's never a bad idea to maintain a global collection
> > > of
> > > any Overlay objects added onto the map. This includes Markers, Polygons,
> > > Polylines, Rectangle, Circle, etc. In terms of what to use as the key in
> > > a
> > > Dictionary collection, I think it depends on what meta data is present in
> > > your app, as long as it's unique.
>
> > > Hope this helps,
>
> > > Dann
>
> > > On Sun, Apr 4, 2010 at 7:27 AM, starenka <[email protected]> wrote:
> > > > Hi all!
>
> > > > I've just fell down the rabbit hole into this map Wonderland. Don't
> > > > bash me for asking a trivial question. I'm trying to bind aclick
> > > > event oninfoBox(http://code.google.com/p/google-maps-utility-library-
> > > > v3/source/browse/trunk/infobox/src/infobox.js?spec=svn50&r=49<http://code.google.com/p/google-maps-utility-library-%0Av3/source/bro...>).
> > > > The
> > > > event just don't seem to work at all (see the alert thing). What's my
> > > > problem? I can't provide an URL but, the functions which spawn
> > > > markers and windows is +- like thishttp://openpaste.org/en/20310/
>
> > > > PS. I need to open the infoboxes later - on demand (not only after
> > > > markerclick). How should i do that? Is storing references to markers/
> > > > info boxes a good idea (f.e a dict with marker/boxes, where key is
> > > > hashed latlon)? How do you solve such things?
>
> > > > Thanks for your time & help
>
> > > > starenka
>
> > > > --
> > > > 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%2B
> > > > [email protected]>
> > > > .
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/google-maps-js-api-v3?hl=en.
>
> > > --
> > > Daniel 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 at
http://groups.google.com/group/google-maps-js-api-v3?hl=en.