2013-02-03 3 views
2

질문 :Leaflet.labelLeaflet.markercluster에 사용할 수 있습니까?전단지 라벨이있는 레이블 게시자 레이블

문제점 : 커서 아이콘 위로 커서를 가져 가면 HTML div가 나타납니다. 일반 마커를 들어

, 당신은

L.marker([-37.7772, 175.2606]).bindLabel('Look revealing label!').addTo(map); 
+0

당신이 봤어 사용하여 마커에 라벨을 부착 사용할 수 있습니까? 'iconCreateFunction' – flup

+0

Mhm ...을 제공하거나'clustermouseover'를 수신 할 수 있습니다. – flup

답변

3

http://jsfiddle.net/WUXXz/

var label = null; 

markers.on('clustermouseover', function (a) { 
    label = new L.Label().setLatLng(a.layer.getLatLng()) 
     .setContent('<p>Hello world!<br />This is a nice popup.</p>') 
     .openOn(map); 
}); 

markers.on('clustermouseout', function() { 
    if (label) { 
     label.close(); 
     label = null; 
    } 
});