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?
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
Comment #1
HiredGuns commentedI am looking for the same thing, but for version 5.X. Any help?
Comment #2
smmtss commentedActually 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 ( ));
}
}
Comment #3
seancorrales commentedThis 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.
Comment #4
chandra sekhar commentedI have removed the following lines but i did not get the default info window
Comment #5
hans0811 commentedThanks 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?
Comment #6
smmtss commentedThanks 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.
Comment #7
hans0811 commented@simeon.mattes: OK, I unassigned you from this feature request. Hopefully somebody knows how to implement this in the macro.
Comment #8
scott_earnest commentedThis 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:
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
Comment #9
afagiolisee also http://drupal.org/node/69402#comment-2507144
Comment #10
coderider commentedi 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