Hello Marcelo,

thanks for your help :-)
I made a simple example: You can find it here:
http://tests.tripplanner.de/

It shows only one marker and on a click on it it shows the infowindow.
The click the infowindow to see, that the "map click" event triggers
before the "div click" event...

This sample only uses my infowindow class and jquery...

Hope this shows my problem :-)

Greetings,
Stefan Sturm

2008/10/24 marcelo <[EMAIL PROTECTED]>:
>
> Stefan,
>
> I cannot do exact debugging because there are too many included files,
> but a couple of things are certainly a problem:
>
> You addOverlay() the infobox inside the marker's click event handler.
> If you click on a second marker you have another copy of the infobox
> show up.
> Instead, you should addOverlay() only once, for example just after you
> create the GMap2 object, and use style.display = 'none' or
> style.display = '' to hide and show the infoBox.
>
> Also, the infoBox div is created with zero size and this might be the
> reason why clicks fire on the map first.
> Try giving it a fixed size, so that the API can better calculate if a
> click was inside or outside the infoBox.
>
> If the above doesn't help, try making a simplified example that
> demonstrates the problem, with only the map, a couple of markers, and
> the infoBox.
> In setting up that example you might find the problem yourself.
>
> --
> Marcelo - http://maps.forum.nu
> --
>
>
>
> On Oct 24, 4:18 pm, "Stefan Sturm" <[EMAIL PROTECTED]>
> wrote:
>> Hello,
>>
>> > 1. removing the console.log() - I get an error on that line
>>
>> Ok, I removed them, They only work, when using Firebug. I use alert 
>> instead...
>>
>> > 2. Remove the .bind(this) - I'm not sure what it's doing there.
>>
>> OK, I removed it. This is from the prototype framework. It makes
>> "this" available in a function. Here is a link to the description in
>> prototype:http://www.prototypejs.org/api/function/bind
>>
>> Greetings,
>> Stefan Sturm
>>
>> > --
>> > Marcelo -http://maps.forum.nu
>> > --
>>
>> > On Oct 24, 3:09 pm, "Stefan Sturm" <[EMAIL PROTECTED]>
>> > wrote:
>> >> Hello,
>>
>> >> thanks for your answer.
>>
>> >> I included your code and now I get the div click triggered, but
>> >> _after_ the map click...
>> >> I made two console.log() outputs to show this...
>>
>> >> And now I get an error:
>> >> a is null in main.js line 269
>>
>> >> Attention: infobox.js is now lockated 
>> >> here:http://demo.tripplanner.de/scripts/tripplanner/infobox.js
>>
>> >> Greetings,
>> >> Stefan Sturm
>>
>> >> 2008/10/24 marcelo <[EMAIL PROTECTED]>:
>>
>> >> > You need to stop propagation of the click event onto the map.
>>
>> >> > Try something like this:
>>
>> >> > Infobox.prototype.initialize = function( map ) {
>> >> >  var that = this;
>> >> >  this.map = map;
>> >> >  this.container = document.createElement("div");
>> >> >  this.container.id = 'infobox';
>> >> > // ...
>> >> >  map.getPane(G_MAP_FLOAT_PANE).appendChild(this.container);
>>
>> >> >  this.container.onclick = function(ev) {
>> >> >    try{ev.stopPropagation()}catch(e){event.cancelBubble=true};
>> >> >    alert('infowindow clicked')
>> >> > //    var clickedInfoWindow = this;
>> >> > //    Your code ....
>> >> >  };
>>
>> >> > // ... etc
>>
>> >> > --
>> >> > Marcelo -http://maps.forum.nu
>> >> > --
>>
>> >> > On Oct 24, 1:58 pm, "Stefan Sturm" <[EMAIL PROTECTED]>
>> >> > wrote:
>> >> >> Hello,
>>
>> >> >> I made e little example to show this problem:http://demo.tripplanner.de
>>
>> >> >> This shows a map with some markers. Just click one marker to open the
>> >> >> infowindow.
>> >> >> Now click inside the infowindow and see, that the infowindow gets
>> >> >> closed. And the firebug console only show the entry "map click".
>> >> >> But it should show "div click"...
>>
>> >> >> The two Event listener still exists.
>>
>> >> >> > // div listener
>> >> >> > GEvent.addDomListener( div, "click", function() {
>> >> >> >        console.log( 'div click' );
>> >> >> > });
>>
>> >> >> > map listener
>> >> >> > GEvent.addListener( map, "click", function() {
>> >> >> >        console.log( 'map click' );
>> >> >> > });
>>
>> >> >> Here are the two javascript files where everything about the map 
>> >> >> happens:http://demo.tripplanner.de/scripts/tripplanner/googleMaps.jshttp://de...
>>
>> >> >> Hope somebody can help me on this :-)
>>
>> >> >> Greetings,
>> >> >> Stefan Sturm
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" 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-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to