Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Readme.md

leaflet study 4.html

这是一个使用 Leaflet.awesome-markers库,自定义标记(marker)的例子。 Custom marker.

使用步骤

  1. 参照 Leaflet.awesome-markers 的 Using the plugin

引入 font-awesome的CSS

<link href="proxy.php?url=http%3A%2F%2Fnetdna.bootstrapcdn.com%2Ffont-awesome%2F4.0.0%2Fcss%2Ffont-awesome.css" rel="stylesheet">

拷贝 Leaflet.awesome-markers的dist文件夹到项目工程中

引入 Leaflet.awesome-markers的css和js

<link rel="stylesheet" href="proxy.php?url=https%3A%2F%2Fgithub.com%2F.%2Fdist%2Fleaflet.awesome-markers.css">
<script src="proxy.php?url=https%3A%2F%2Fgithub.com%2F.%2Fdist%2Fleaflet.awesome-markers.js"></script>
  1. 在添加marker时候使用 awesome-markers库
var marker = L.marker([a[3], a[2]], { icon: L.AwesomeMarkers.icon({ icon: 'camera', prefix: 'fa', markerColor: 'blue', spin:true }) })
	//添加Popup事件。当鼠标点击时候显示。
	marker.bindPopup(sucontents);
	marker.addTo(map);

示例图

示例图