Google Maps Plugin for jQuery with Autozoom

Jocelyn's picture

This update adds Autozoom functionality to the Google Maps Plugin for jQuery.

Updated Behaviour
Automatically center and zoom GMap to fit all markers. Autozoom will look to use latitude & longitude for each marker first, otherwise it will get the coordinates using the address field via the Google Maps API geocoder.

Default Behaviour
You can set either the latitude & longitude or address for the map and the default zoom level. If neither the latitude & longitude or address is specified, the map will center on the first marker.

What is gMap?

gMap is a lightweight jQuery plugin that helps you embed Google Maps into your website. With only 2 KB in size it is very flexible and highly customizable.

Usage

One property has been added to the gMap() function. For full usage documentation, refer to the gMap documentation.

autozoom: boolean
Default: true
If true, the map will autzoom and center to fit all markers. If "latitude" latitude & longitude or address specified, those will be used instead of the marker list.
$('#map').gMap({
  autozoom: true
});

Download

Licensing

Creative Commons License gMap is licensed under Creative Commons BY-SA 3.0 license. In short: You're allowed to copy, distribute, transmit and to adapt - as long as you attribute the work. If you alter, modify or build upon this sourcecode, you may distribute the resulting work only under the same, similar or compatible license.

Comments

chillers's picture

thanks for sharing it

Tom's picture

Hi there, is it possible to use it for example like it's been use here?
htpp://adsoftheworld.com/media/online/volkswagen_fox_twitter_zoom

Very curious!

BR Tom

gyaneshwar's picture

thanks

Jleagle's picture

Not working for me in IE, just displays a grey box.

Cory's picture

You can't imagine how helpful this is to me. Been trying to work this out for the better part of a year.

Dairon Medina's picture

Nice and very useful to me. Thanks for sharing and best reggards from Cuba.

marcus's picture

thanks for this! very useful.
couldnt get the original gmap to work.

best,
m

Add New Comment