info window opening on load

simeon.mattes - June 10, 2009 - 19:24
Project:GMap Module
Version:6.x-1.1-rc1
Component:User interface
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

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?

#1

ReedtheFeed - June 10, 2009 - 19:50

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

#2

simeon.mattes - June 13, 2009 - 11:35

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 ( ));

}

}

#3

droidenator - June 25, 2009 - 15:34

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.

#4

chandra sekhar - September 17, 2009 - 09:45

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

#5

hans0811 - October 22, 2009 - 08:31

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?

#6

simeon.mattes - October 23, 2009 - 10:33

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.

#7

hans0811 - October 23, 2009 - 12:42
Assigned to:simeon.mattes» Anonymous

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

 
 

Drupal is a registered trademark of Dries Buytaert.