3
我正在使用傳單來顯示原始行程以轉到某些標記。 我用小冊子折線顯示我的行程。 但我希望能夠隱藏並在小冊子中顯示折線?
如何隱藏和顯示傳單中的折線?
我可以這樣做:
$('.leaflet-overlay-pane').hide();
和
$('.leaflet-overlay-pane').show();
但是,這將顯示和隱藏我所有的折線。 我希望能夠分開隱藏和顯示它們。
謝謝。
我正在使用傳單來顯示原始行程以轉到某些標記。 我用小冊子折線顯示我的行程。 但我希望能夠隱藏並在小冊子中顯示折線?
如何隱藏和顯示傳單中的折線?
我可以這樣做:
$('.leaflet-overlay-pane').hide();
和
$('.leaflet-overlay-pane').show();
但是,這將顯示和隱藏我所有的折線。 我希望能夠分開隱藏和顯示它們。
謝謝。
如果你有折線
var polyline = L.polyline(...);
然後參考你可以在一瞬間使用
map.addLayer(polyline);//For show
map.removeLayer(polyline);// For hide
我想有隻隱藏/顯示沒有本地方法,也許在0.7版本
其他解決方案是訪問對象容器,在維護者的舊commet中訪問
I don't think there's an easy solution, for tile layers at least. :(I'll try to handle this sooner.
For vectors, you can change path._container.style.display, and for markers - marker._image.style.display and marker._shadow.style.display.