To facilitate the work with the Google Maps API, I am developing a jquery plugin. It have some defaults. follows:
Defaults jquery plugin (Code in coffee-script)
(($, window, document) ->
# Defaults
defaults =
zoom: 16
disableDefaultUI: true
zoomControl: true
zoomControlOptions:
style: google.maps.ZoomControlStyle.LARGE
position: google.maps.ControlPosition.RIGHT_CENTER
mapTypeControl: true
mapTypeControlOptions:
style: google.maps.MapTypeControlStyle.DROPDOWN_MENU
position: google.maps.ControlPosition.TOP_LEFT
mapTypeId: google.maps.MapTypeId.ROADMAP
...
Notice the options zoomControlOptions.
My problem is that the JS file is unique for every page, the script:
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
is on the contact page (which is where I use the API).
This plugin depends on the google maps API to work, how to load the plugin only on the contact page? Better yet, how to load the plugin only if the Google Maps API is available?
Thank you all for your help!
At the top of your wrapper, write this: