On Dec 4, 5:40 pm, julz <[EMAIL PROTECTED]> wrote:
> I have created a dynamic legend via a custom control.  I have a box
> that I can check or uncheck (to turn the entire overlay, which also
> has markers, on or off).  All I want is for the legend to also go away
> when I toggle off.  This has got to be easy right?  Right now the
> markers go off but the legend remains.

You should really have given a link. Custom controls don't come with a
method to do this, and you need to provide it. One way is:

function my_control() {}
my_control.prototype = new GControl();
my_control.prototype.initialize = function() {
        var contents = document.createElement("div");
        contents.id="controldiv";
        contents.innerHTML="Legend";
        document.getElementById('map').appendChild(contents);
        return contents;
      }
my_control.prototype.printable=function(){return true};
my_control.prototype.selectable=function(){return true};
my_control.prototype.hide=function(){document.getElementById
("controldiv").style.display="none"}
my_control.prototype.show=function(){document.getElementById
("controldiv").style.display="block"}
my_control.prototype.getDefaultPosition=function(){
        return new GControlPosition(G_ANCHOR_BOTTOM_RIGHT,new GSize(4,15))
      }

You then get .hide() and .show() methods on your control. The methods
set the display of the contents of the control.

Andrew
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to