Custom Options
Last updated
Last updated
Many APIs have far more options than are used by default. Let's take a look at a couple more of the options available through GoogleMaps.
Before we add any options, look at the disableDefaultUI
option on the myOptions
object. Notice that it is currently set to true
. Set it to false
, save the program, then refresh your window. You can see that the zoom, fullscreen, and other options are now enabled. Set the option back to true
, and add the following code beneath the disableDefaultUI
property. Remember to add a comma after disableDefaultUI
, or the program will break!
That's it! Now go customize it some more! Add some other listeners to provide more functionality, or add more stuff to the page through the HTML. Go crazy! Make it your own!
These options add the ability to zoom in and out, switch between map and satellite views, and adds the map scale to the bottom of the map, while keeping the rest of the default options hidden. There are many more options that can be used with GoogleMaps, and they can be found .