Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #23988 > unrolled thread
| Started by | Tuxedo <tuxedo@mailinator.com> |
|---|---|
| First post | 2014-04-29 18:27 +0200 |
| Last post | 2014-04-30 20:46 +0800 |
| Articles | 4 — 3 participants |
Back to article view | Back to comp.lang.javascript
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
| From | Tuxedo <tuxedo@mailinator.com> |
|---|---|
| Date | 2014-04-29 18:27 +0200 |
| Subject | Displaying 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]
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Date | 2014-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]
| From | Tuxedo <tuxedo@mailinator.com> |
|---|---|
| Date | 2014-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]
| From | Richard Maher <maher_rjSPAMLESS@hotmail.com> |
|---|---|
| Date | 2014-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