現在Leafletを使って
onclickイベントが起こったら、マーカーを立てるようにしていたのですが、
その要素に対して更に.openPopupを付けたいと考えました。
もしonllickイベントが入れ子になっていたらどうなるのでしょうか?
前回の質問
https://teratail.com/questions/62367
javascript
1$('#test01').on('click', function(){ 2//idがtest01の要素をクリックすると、指定されたいくつかのマーカーが表示される 3 4function onEachFeature(feature, layer) { 5 var popupContent = "<p>test " + 6 feature.geometry.type + ", test--test</p>"; 7 8 if (feature.properties && feature.properties.popupContent) { 9 popupContent += feature.properties.popupContent; 10 } 11 layer.bindPopup(popupContent); 12 13 14 var aaa = 'aaa'; 15 layer.bindPopup( feature.properties.popupContent ); 16 $('#test_txt').append('<div id=\"' + feature.id + '\">' + aaa + '</div>' ); 17 $( '#' + feature.id ).click( function() { 18 layer.openPopup(); 19 } ); 20 } 21 22}
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/01/19 10:07