R:闪亮的工具提示部分隐藏
R: Shiny Tooltip is partially hidden
我正在使用包 bsplus 在 shiny/flexhdashboard 环境中制作工具提示,但我发现其中一些被隐藏或部分隐藏在视线之外。为什么?
例如:
require(shiny)
require(flexdashboard)
bsplus::use_bs_tooltip()
bsplus::use_bs_popover()
shinyWidgets::sliderTextInput(inputId = "prevalence",
label = "% infectious passengers boarding:",
grid = TRUE,
force_edges = TRUE,
choices = c(0.1,0.2,0.3))%>%
shinyInput_label_embed(
icon("info") %>%
bs_embed_tooltip(title = "A realistic value is no more than about 0.25% or 250 in 100,000")
)
产品
我真的不能说这是否有效,因为你的例子不能完全重现,但根据 this answer 可以使用 data-container="body"
属性解决。
幸运的是 bsplus 使这变得非常简单:只需将 container='body'
添加到 bs_embed_tooltip()
require(shiny)
require(flexdashboard)
library(dplyr)
library(bsplus)
bsplus::use_bs_tooltip()
bsplus::use_bs_popover()
shinyWidgets::sliderTextInput(inputId = "prevalence",
label = "% infectious passengers boarding:",
grid = TRUE,
force_edges = TRUE,
choices = c(0.1,0.2,0.3))%>%
shinyInput_label_embed(
icon("info") %>%
bs_embed_tooltip(title = "A realistic value is no more than about 0.25% or 250 in 100,000", container='body')
)
# Results:
<div class="form-group shiny-input-container">
<label class="control-label" for="prevalence" style="width:100%;">
% infectious passengers boarding:
<div class="pull-right">
<i class="fa fa-info" title="A realistic value is no more than about 0.25% or 250 in 100,000" data-toggle="tooltip" data-placement="top" data-container="body"></i>
</div>
</label>
<input class="js-range-slider sw-slider-text" data-data-type="text" data-force-edges="true" data-from="0" data-from-fixed="false" data-from-shadow="false" data-grid="true" data-hide-min-max="false" data-keyboard="true" data-prettify-enabled="false" data-swvalues="["0.1","0.2","0.3"]" data-to-fixed="false" data-to-shadow="false" id="prevalence"/>
</div>
我正在使用包 bsplus 在 shiny/flexhdashboard 环境中制作工具提示,但我发现其中一些被隐藏或部分隐藏在视线之外。为什么?
例如:
require(shiny)
require(flexdashboard)
bsplus::use_bs_tooltip()
bsplus::use_bs_popover()
shinyWidgets::sliderTextInput(inputId = "prevalence",
label = "% infectious passengers boarding:",
grid = TRUE,
force_edges = TRUE,
choices = c(0.1,0.2,0.3))%>%
shinyInput_label_embed(
icon("info") %>%
bs_embed_tooltip(title = "A realistic value is no more than about 0.25% or 250 in 100,000")
)
产品
我真的不能说这是否有效,因为你的例子不能完全重现,但根据 this answer 可以使用 data-container="body"
属性解决。
幸运的是 bsplus 使这变得非常简单:只需将 container='body'
添加到 bs_embed_tooltip()
require(shiny)
require(flexdashboard)
library(dplyr)
library(bsplus)
bsplus::use_bs_tooltip()
bsplus::use_bs_popover()
shinyWidgets::sliderTextInput(inputId = "prevalence",
label = "% infectious passengers boarding:",
grid = TRUE,
force_edges = TRUE,
choices = c(0.1,0.2,0.3))%>%
shinyInput_label_embed(
icon("info") %>%
bs_embed_tooltip(title = "A realistic value is no more than about 0.25% or 250 in 100,000", container='body')
)
# Results:
<div class="form-group shiny-input-container">
<label class="control-label" for="prevalence" style="width:100%;">
% infectious passengers boarding:
<div class="pull-right">
<i class="fa fa-info" title="A realistic value is no more than about 0.25% or 250 in 100,000" data-toggle="tooltip" data-placement="top" data-container="body"></i>
</div>
</label>
<input class="js-range-slider sw-slider-text" data-data-type="text" data-force-edges="true" data-from="0" data-from-fixed="false" data-from-shadow="false" data-grid="true" data-hide-min-max="false" data-keyboard="true" data-prettify-enabled="false" data-swvalues="["0.1","0.2","0.3"]" data-to-fixed="false" data-to-shadow="false" id="prevalence"/>
</div>