@posterno/google-maps-html-marker

1.0.0 • Public • Published

Google Maps HTML Markers

A tiny javascript helper library to create html markers with Google maps.

Installation

npm install @posterno/google-maps-html-marker

or

yarn add @posterno/google-maps-html-marker

Usage

Load the helper library in your javascript file:

const createHTMLMapMarker = require( 'google-maps-html-marker' );

const latLng = new google.maps.LatLng(16.7666, -3.0026);
const mapOptions = {
	zoom: 11,
	center: latLng
};
const map = new google.maps.Map(document.getElementById("map"), mapOptions);

let marker = createHTMLMapMarker({
	latlng: latLng,
	map: map,
	html: `<img id="parrot" src="https://cultofthepartyparrot.com/parrots/hd/parrot.gif">`
});

marker.addListener("click", () => {
	alert("Partyin Partyin Yeah!");
});

Credits

This library was originally created by Dan Ward and published as a tutorial here.

I've simply converted it to an ES5 javascript module and published it on the npmjs registry so that it's easier to re-use for my projects.

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.0.0125latest

Version History

VersionDownloads (Last 7 Days)Published
1.0.0125

Package Sidebar

Install

npm i @posterno/google-maps-html-marker

Weekly Downloads

125

Version

1.0.0

License

MIT

Unpacked Size

3.25 kB

Total Files

4

Last publish

Collaborators

  • alessandrotesoro