2.8.2 • Published 6 years ago

@wearejust/gmaps v2.8.2

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

GMaps

Turns an element into Google Maps.

Installation

npm install @wearejust/gmaps

yarn add @wearejust/gmaps

Usage

const GMaps = require('@wearejust/gmaps');

// Turn element into Google Maps
let gmaps = new GMaps(element, options, mapOptions, callback);

// Or use jQuery
$('.gmaps').gmaps(options, mapOptions, callback);

// Remove element
gmaps.destroy();

// Remove only listeners
gmaps.destroy(false);
ParameterValueDefaultDescription
elementDOM, string, object.gmapsCan be DOM element, selector string or jQuery object
optionsobjectnullSee Options below
mapOptionsobjectnullSee Map Options below
callbackfunctionnullCallback when GMaps is initialized

See examples folder for more details

Options

KeyValueDefaultDescription
apiKeystringnullYour Google Maps API key
clusterboolean, objectnullEnable Marker Clustering. See used package repository for options.
fitbooleantrueFit all markers on screen
fitZoominteger-1Amount to zoom extra after fit
fitZoomMininteger0Minimum zoom after fitZoom
fitZoomMaxinteger20Maximum zoom after fitZoom
infowindowobjectnullObject with custom infowindow options. Use the default key to apply as default.
markersobjectnullObject with keys of custom marker options. Use the default key to apply as default.
markerEmptyZoominteger, string'3'Amount to zoom in on clicked empty markers. Use integer for fixed level, string to add/subtract current level.
searchDOM, string, objectnullSearch input field to find places on the map
spreadinteger0Amount to spread markers with the same location

Map Options

Default Google Maps MapOptions. For more see https://developers.google.com/maps/documentation/javascript/reference#MapOptions

KeyDefault
mapTypeControlfalse
streetViewControlfalse
zoom17

Events

The jQuery element can have events bound to it.

let gmaps = $('.gmaps').gmaps(options, mapOptions, callback);

gmaps.on('ready', function(e, g) {
  // e is the event
  // g refers to the GMaps object
});
EventDescription
content_closeAfter closing the Content of a Marker
content_openAfter opening the Content of a Marker
destroyAfter destroy() is called
marker_closeAfter closing a Marker
marker_highlightAfter tabbing through Markers
marker_mouseoutAfter hovering out a Marker
marker_mouseoverAfter hovering over a Marker
marker_openAfter opening a Marker
overlay_addAfter adding the custom Overlay of a Marker to the map
overlay_drawAfter drawing the custom Overlay of a Marker in the map
overlay_removeAfter removing the custom Overlay of a Marker from the map
readyAfter initialization
searchAfter searching
zoomAfter zooming in or out
2.8.2

6 years ago

2.8.1

6 years ago

2.7.1

6 years ago

2.6.0

6 years ago

2.5.1

6 years ago

2.5.0

6 years ago

2.4.0

6 years ago

2.3.2

6 years ago

2.3.1

6 years ago

2.3.0

6 years ago

2.2.4

6 years ago

2.2.3

6 years ago

2.2.2

6 years ago

2.2.1

6 years ago

2.2.0

6 years ago

2.1.2

6 years ago

2.1.1

6 years ago

2.1.0

6 years ago

1.4.3

6 years ago

1.4.2

6 years ago

1.4.1

6 years ago

1.4.0

6 years ago

1.3.1

6 years ago

1.3.0

6 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.4

7 years ago

1.1.3

7 years ago

1.1.0

7 years ago

1.0.0

7 years ago