JS
//简单的标注
var marker = L.marker([ 31.2, 114.5 ], {
// icon:myIcon
}).addTo(map)
// 设置label
.bindTooltip("This is a test.", {
permanent : true,
offset : [ 0, 0 ],// 偏移
direction : "right",// 放置位置
// sticky:true,//是否标记在点上面
className : 'anim-tooltip',// CSS控制
}).openTooltip();
CSS
.anim-tooltip{
transition: opacity 4.0s linear;/*动画效果*/
font:italic bold 12px/30px arial,sans-serif;
font-family:"Times New Roman",Georgia,Serif;
/*字体发光*/
text-shadow: 1px 0 0 #8B4513, 0 1px 0 #8B4513,
0 -1px 0 #8B4513, -1px 0 0 #8B4513,
1px 0 1px #8B4513, 0 1px 1px #8B4513,
0 -1px 1px #8B4513, -1px 0 1px #8B4513;
}
参考> http://stackoverflow.com/questions/42001003/leaflet-tooltip-wont-animate-correctly