传单般的标志物
具有Fontawesome图标的非常简单的矢量标记,与传单V1兼容。
使用:
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" } ) ; 公共方法
| 方法 | 参数 | 描述 |
|---|---|---|
setStyle | {Object} | 使用新样式配置更新图标 |
下载源码
通过命令行克隆项目:
git clone https://github.com/danwild/leaflet-fa-markers.git