Hi everybody,

I'm trying to find, how I'm going to make the info window in google map stay open on load.

Could any one help me?

Comments

HiredGuns’s picture

I am looking for the same thing, but for version 5.X. Any help?

smmtss’s picture

Actually I have found in the Api of Google Maps that wile the page is loading the following function will make the infoWindow to stay open

marker.openInfoWindowTabsHtml(infoTabs);

Though I don't know what to do with drupal!

eg.

window.onload = function load()
{

if (GBrowserIsCompatible())
{

var map = new GMap2(document.getElementById("map"));
map.setCenter(new GLatLng(37.923584,23.752141), 16); // NOTE: coordination
var infoTabs = [new GInfoWindowTab( "Tab #1", " Name

Info
here")]; // NOTE:personal info

var marker = new GMarker(map.getCenter());
GEvent.addListener(marker, "click", function()
{
marker.openInfoWindowTabsHtml(infoTabs);
});

map.addOverlay(marker);
marker.openInfoWindowTabsHtml(infoTabs);

map.addControl(new GLargeMapControl ( ));
map.addControl(new GMapTypeControl ( ));
map.addControl(new GScaleControl ( ));

}

}

seancorrales’s picture

This isn't really a solution per say but this worked for me. Keep in mind, I have this module installed on a site and I'm only displaying one map with one marker.

Go to js/marker.js in the gmap module and comment out lines 39 and 41. Basically this checks for the option "autoclick" and, if it's present, automatically displays the marker. By commenting out the line, you're effectively saying "always auto display the info box". I have no idea how this would work with multiple markers so use at your own risk.

I could not find a way to feed the options in via macro. If there is support for it, then I'd assume you could just throw an "options=autoclick" somewhere in your macro for a specific marker and that marker should automatically display.

It looks like the functionality is in place, the macro just needs to be able to handle the "options" option.

chandra sekhar’s picture

I have removed the following lines but i did not get the default info window

hans0811’s picture

Thanks droidenator!!!
Commenting those two lines works fine for me too. I also have only one map with one marker on my site.
It would indeed be better if this could be defined in the macro.

@simeon.mattes: I see this is assigned to you. Are you working on this?

smmtss’s picture

Thanks for your help...Actually, I did what droidenator said, but I don't agree on changing the function of modules...and although it is quite easy to "overide" a function in php, I don't know if it is a way in the api of drupal to do it for a javascript file.

hans0811’s picture

Assigned: smmtss » Unassigned

@simeon.mattes: OK, I unassigned you from this feature request. Hopefully somebody knows how to implement this in the macro.

scott_earnest’s picture

This seems like a relatively common request that was hard to find documentation for. I discovered that putting in "%autoclick" (without quotes) after the lat/long on the marker opens that info window.

For example:

[gmap markers=alt small red::37.4228,-122.085%autoclick |zoom=16 |center=37.4228, -122.085 |width=580px |height=380px |control=Small |type=Map]

I found this trick here:
http://groups.drupal.org/node/10626

Hope this helps somebody.

---------- after thought ------------

Not sure why I didn't see this sooner. I think I was searching on words like "info window" and not "marker":

http://drupal.org/node/69402

afagioli’s picture

Status: Active » Closed (duplicate)
coderider’s picture

Title: info window opening on load » info window opening on load fixed
Version: 6.x-1.1-rc1 » 7.x-1.0-beta1
Assigned: Unassigned » coderider
Status: Closed (duplicate) » Fixed

i find a way to set gmap marker on autoclick i am useing this template function at my project site it works fine
copy hole function theme_gmap from gmap.module line/935 and past in to you template.php
rename it THEME_gmap.
and add this line

$map['markers'][0]['autoclick'] = TRUE;

i have make thread for complete edited function see here
https://drupal.org/node/69402#comment-7007336
thanks
coderider

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.