Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Put a button on top of a google map

I would like to put a button on top of a Google Map next to the Map, Satelite and Hybrid buttons.

I was wondering if its possible and how would be the best way to do it?

So ideas I have are overlaying a image on top of the google map that is clickable but not sure if that will take all the events away from the google map.

Do you have any ideas on how it could be done?

like image 688
Mark Ellul Avatar asked Jul 01 '09 09:07

Mark Ellul


1 Answers

The accepted answer is from 2009 (5 years ago) and links to a deprecated version of Google Maps API.

While searching for the very same question I've found this example: https://developers.google.com/maps/documentation/javascript/examples/control-custom

// Create the DIV to hold the control and
// call the HomeControl() constructor passing
// in this DIV.
var homeControlDiv = document.createElement('div');
var homeControl = new HomeControl(homeControlDiv, map);

homeControlDiv.index = 1;
map.controls[google.maps.ControlPosition.TOP_RIGHT].push(homeControlDiv);
like image 133
Mars Robertson Avatar answered Sep 22 '22 20:09

Mars Robertson