Monday, July 4, 2011

Adding an extra copyright logo to Google map

The original complete example is here: http://code.google.com/p/gmaps-samples-v3/source/browse/trunk/custom-copyirghts/custom-copyrights.html?r=238

And in short description, you just need to use the "controls" property of the Google map object. Add the "div" containing your copyright logo to the control array located at any of the four corners of the map. Example codes are like the following:

//After creating the map:
crDiv = document.createElement('div');
crDiv.innerHTML = "<img src='http://your.website.com/yourAppDir/logo.png' />";
map.controls[google.maps.ControlPosition.BOTTOM_RIGHT].push(crDiv);

You can create other type of copyright objects by modifying the "innerHTML" of crDiv, or by creating other types of inner elements.

No comments: