Well I finally figured out a way I could accomplish it, however I
don't feel like it's the proper way to do the job.

My solution was to add a map control, that is the image with a click
function.

 // A BWSponsor is a GControl that displays their logo
// We define the function first
function BWSponsor() {
}

// To "subclass" the GControl, we set the prototype object to
// an instance of the GControl object
BWSponsor.prototype = new GControl();

// Creates a one DIV for each of the buttons and places them in a
container
// DIV which is returned as our control element. We add the control to
// to the map container and return the element for the map class to
// position properly.
BWSponsor.prototype.initialize = function(map) {
  var container = document.createElement("div");

  var zoomInDiv = document.createElement("div");
  this.setButtonStyle_(zoomInDiv);
  container.appendChild(zoomInDiv);
  var img = document.createElement("img");
  img.src="http://www.mysite.com/sponsor.png";;

  $(img).click( function(){ window.location.href="http://
www.mysite.com" });
  zoomInDiv.appendChild(img);

  map.getContainer().appendChild(container);
  return container;
}

// By default, the control will appear in the top left corner of the
// map with 7 pixels of padding.
BWSponsor.prototype.getDefaultPosition = function() {
  return new GControlPosition(G_ANCHOR_BOTTOM_LEFT, new GSize(70, 3));
}

// Sets the proper CSS for the given button element.
BWSponsor.prototype.setButtonStyle_ = function(button) {
  button.style.textDecoration = "underline";
  button.style.color = "#0000cc";
  button.style.font = "small Arial";
  button.style.padding = "2px";
  button.style.marginBottom = "3px";
  button.style.textAlign = "center";
  button.style.width = "6em";
  button.style.cursor = "pointer";
}


map.addControl(new BWSponsor());




On Jun 22, 3:02 pm, "[email protected]" <[email protected]> wrote:
> I'm looking to add a logo with a hyperlink click to a custom map that
> never changes location on the map.
>
> In order to do this I've used the GScreenOverlay object and added the
> overlay to the map. However no matter what I'm trying can I seem to
> get it to recognize a click on the image.
>
> How can I do this?
>
> Below is the code I'm using to add a Screen overlay.
>
> var overlay = new GScreenOverlay("http://<my url>/logo.png", new
> GScreenPoint(70,5), new GScreenPoint(0,0), new GScreenSize(102,41));
> $(overlay).addClass("screenOverlay");
> map.addOverlay(overlay);
--~--~---------~--~----~------------~-------~--~----~
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