Skip to content

Commit

Permalink
Merge pull request #428 from thenickcox/add_options_docs
Browse files Browse the repository at this point in the history
Add docs in the README for passing options
  • Loading branch information
apneadiving committed Feb 19, 2014
2 parents 39298d0 + f129879 commit 666998a
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions README.rdoc
Expand Up @@ -81,6 +81,43 @@ Create your map:
handler.fitMapToBounds();
});

5) Add options:

You're likely going to want to customize your maps by passing an options object. Using the example above,
let's say you'd like to disable the map controls. This and any other options you can find in the {Google
Maps API reference}[https://developers.google.com/maps/documentation/javascript/reference]
can be passed into the `provider` options hash like so:

handler = Gmaps.build('Google');
handler.buildMap({
provider: {
disableDefaultUI: true
// pass in other Google Maps API options here
},
internal: {
id: 'map'
},
function(){
markers = handler.addMarkers([
{
"lat": 0,
"lng": 0,
"picture": {
"url": "https://addons.cdn.mozilla.net/img/uploads/addon_icons/13/13028-64.png",
"width": 36,
"height": 36
},
"infowindow": "hello!"
}
]);
handler.bounds.extendWith(markers);
handler.fitMapToBounds();
}
});

You can see other examples of adding `provider` options in the {live examples}[http://apneadiving.github.io/]. Also,
check the {wiki}[https://github.com/apneadiving/Google-Maps-for-Rails/wiki/Js-Methods] for further documentation on
the possible JavaScript methods.

== Generating JSON

Expand Down

0 comments on commit 666998a

Please sign in to comment.