Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #23988 > unrolled thread

Displaying infoWindow onload or onclick?

Started byTuxedo <tuxedo@mailinator.com>
First post2014-04-29 18:27 +0200
Last post2014-04-30 20:46 +0800
Articles 4 — 3 participants

Back to article view | Back to comp.lang.javascript


Contents

  Displaying infoWindow onload or onclick? Tuxedo <tuxedo@mailinator.com> - 2014-04-29 18:27 +0200
    Re: Displaying infoWindow onload or onclick? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-04-29 20:46 +0100
      Re: Displaying infoWindow onload or onclick? Tuxedo <tuxedo@mailinator.com> - 2014-04-29 23:12 +0200
    Re: Displaying infoWindow onload or onclick? Richard Maher <maher_rjSPAMLESS@hotmail.com> - 2014-04-30 20:46 +0800

#23988 — Displaying infoWindow onload or onclick?

FromTuxedo <tuxedo@mailinator.com>
Date2014-04-29 18:27 +0200
SubjectDisplaying infoWindow onload or onclick?
Message-ID<ljojta$15t$1@news.albasani.net>
The below code is part of gmap v3 whereby clicking on one of several pins 
on a typical google map will pop up an info-window at the pointer. The 
function is part of a larger code block with various display options:
 
var onMarkerSomewhere = function() {
var marker = this;
var latLng = marker.getPosition();
infoWindow.setContent('hello');
infoWindow.open(map, marker);
};

var Somewhere = new google.maps.Marker({
map: map,
position: new google.maps.LatLng(-36.874638, 49.847593)

});

google.maps.event.addListener(Somewhere, 'click', onMarkerLocation);

I would like to launch the info-window from an external link elsewhere on 
the page or at onload of the document. It's basically the 
'onMarkerSomewhere' that needs to run in another situation than the onclick 
of the marker itself. How would the function call be constructed to run for 
example in an onclick or in a subsequent part of the code block?

Many thanks for any pointers!
Tuxedo

[toc] | [next] | [standalone]


#23989

FromBen Bacarisse <ben.usenet@bsb.me.uk>
Date2014-04-29 20:46 +0100
Message-ID<0.50ba9c545d33dacc43b2.20140429204602BST.87k3a7x6kl.fsf@bsb.me.uk>
In reply to#23988
Tuxedo <tuxedo@mailinator.com> writes:

> The below code is part of gmap v3 whereby clicking on one of several pins 
> on a typical google map will pop up an info-window at the pointer. The 
> function is part of a larger code block with various display options:
>  
> var onMarkerSomewhere = function() {
> var marker = this;
> var latLng = marker.getPosition();
> infoWindow.setContent('hello');
> infoWindow.open(map, marker);
> };
>
> var Somewhere = new google.maps.Marker({
> map: map,
> position: new google.maps.LatLng(-36.874638, 49.847593)
>
> });
>
> google.maps.event.addListener(Somewhere, 'click', onMarkerLocation);
>
> I would like to launch the info-window from an external link elsewhere on 
> the page or at onload of the document. It's basically the 
> 'onMarkerSomewhere' that needs to run in another situation than the onclick 
> of the marker itself. How would the function call be constructed to run for 
> example in an onclick or in a subsequent part of the code block?

If I follow what's going on here, you need to evaluate

   onMarkerSomewhere.apply(Somewhere)

<snip>
-- 
Ben.

[toc] | [prev] | [next] | [standalone]


#23990

FromTuxedo <tuxedo@mailinator.com>
Date2014-04-29 23:12 +0200
Message-ID<ljp4k3$31g$1@news.albasani.net>
In reply to#23989
Ben Bacarisse wrote:

[...]

>    onMarkerSomewhere.apply(Somewhere)

This is exactly what was needed!

Many Thanks! 

Tuxedo

[toc] | [prev] | [next] | [standalone]


#23991

FromRichard Maher <maher_rjSPAMLESS@hotmail.com>
Date2014-04-30 20:46 +0800
Message-ID<ljqrbj$1f9$1@speranza.aioe.org>
In reply to#23988
On 4/30/2014 12:27 AM, Tuxedo wrote:
> The below code is part of gmap v3 whereby clicking on one of several pins
> on a typical google map will pop up an info-window at the pointer. The
> function is part of a larger code block with various display options:
>
> var onMarkerSomewhere = function() {
> var marker = this;
> var latLng = marker.getPosition();
> infoWindow.setContent('hello');
> infoWindow.open(map, marker);
> };
>
> var Somewhere = new google.maps.Marker({
> map: map,
> position: new google.maps.LatLng(-36.874638, 49.847593)
>
> });
>
> google.maps.event.addListener(Somewhere, 'click', onMarkerLocation);
>
> I would like to launch the info-window from an external link elsewhere on
> the page or at onload of the document. It's basically the
> 'onMarkerSomewhere' that needs to run in another situation than the onclick
> of the marker itself. How would the function call be constructed to run for
> example in an onclick or in a subsequent part of the code block?
>
> Many thanks for any pointers!
> Tuxedo
>

google.maps.event.trigger(targetObject,"click");

?

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.javascript


csiph-web