带有单击按钮以关闭的工具提示 -Leaflet
Tooltip with click button to close -Leaflet
我想在带有 instruction.when 的页面上显示带有关闭按钮的工具提示,页面加载工具提示应该带有关闭按钮,以便在阅读说明后人们可以使用此代码关闭 tooltip.currently我设法加载工具提示,但我想添加一个像弹出窗口一样的关闭按钮来关闭工具提示。我该如何添加?
var tooltip = L.tooltip({
direction: 'center',
permanent: true,
interactive: true,
noWrap: true,
opacity: 0.9
});
tooltip.setContent( "instructions" );
tooltip.setLatLng(new L.LatLng(23.951,149.861));
tooltip.addTo(map);
OP 在评论中询问,如何在单击地图或弹出窗口时禁用关闭:
您可以使用选项 closeOnClick: false
Doc:
var popup = L.popup({closeOnClick: false, closeButton: true, autoClose: true, closePopupOnClick :false })
.setLatLng([20.951,149.861])
.setContent("intro")
.openOn(map);
我想在带有 instruction.when 的页面上显示带有关闭按钮的工具提示,页面加载工具提示应该带有关闭按钮,以便在阅读说明后人们可以使用此代码关闭 tooltip.currently我设法加载工具提示,但我想添加一个像弹出窗口一样的关闭按钮来关闭工具提示。我该如何添加?
var tooltip = L.tooltip({
direction: 'center',
permanent: true,
interactive: true,
noWrap: true,
opacity: 0.9
});
tooltip.setContent( "instructions" );
tooltip.setLatLng(new L.LatLng(23.951,149.861));
tooltip.addTo(map);
OP 在评论中询问,如何在单击地图或弹出窗口时禁用关闭:
您可以使用选项 closeOnClick: false
Doc:
var popup = L.popup({closeOnClick: false, closeButton: true, autoClose: true, closePopupOnClick :false })
.setLatLng([20.951,149.861])
.setContent("intro")
.openOn(map);