leaflet-fa-markers

0.1.0 • Public • Published

leaflet-fa-markers NPM version NPM Downloads

Very simple vector markers with FontAwesome icons, compatible with Leaflet v1.

Screenshot

Use:

var blueMarker = L.marker([lat, lon], {
  icon: L.icon.fontAwesome({
    iconClasses: "fa fa-info-circle", // you _could_ add other icon classes, not tested.
    // marker/background style
    markerColor: "#00a9ce",
    markerFillOpacity: 0.2,
    markerStrokeWidth: 1,
    markerStrokeColor: "grey",
    // icon style
    iconColor: "#FFF"
  })
}).addTo(map);
 
var spinningMarker = L.marker([lat, lon], {
  icon: L.icon.fontAwesome({
    iconClasses: "fa fa-circle-o-notch fa-spin",
    markerColor: "#ff89b5",
    iconColor: "#FFF",
    // use XY offsets to nudge positioning of icons, negative accepted
    iconXOffset: -2,
    iconYOffset: 0
  })
}).addTo(map);
 
// update existing
blueMarker.options.icon.setStyle({ markerColor: "#F00" });

Public methods

method params description
setStyle {Object} update the icon with new style config

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.1.0
    21
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.1.0
    21
  • 0.0.5
    5

Package Sidebar

Install

npm i leaflet-fa-markers

Weekly Downloads

26

Version

0.1.0

License

Apache-2.0

Unpacked Size

52.4 kB

Total Files

7

Last publish

Collaborators

  • danwild