gpt4 book ai didi

r - 延迟和终止 shinyBS::bsTooltip

转载 作者:行者123 更新时间:2023-12-04 01:40:12 26 4
gpt4 key购买 nike

是否可以延迟工具提示并在几秒钟后过期?

require(shiny)
require(shinyBS)

shinyApp(ui = fluidPage(
shinyjs::useShinyjs(),
bsTooltip(id = 'input', title = "Lets delay this appearing for 1s and force disappear after 5s",
placement = "bottom", trigger = "hover", options = list(delay = list(show=1000, hide=3000))),

sidebarLayout(
sidebarPanel(
selectInput(inputId = 'input', label = 'input', choices = c('cats','dogs'))
),
mainPanel()
)
)
, server = function(input, output){})

enter image description here

最佳答案

shinyBS::bsTooltip 无法正确序列化 https://github.com/ebailey78/shinyBS/blob/shinyBS3/R/Tooltips_and_Popovers.R#L129 中嵌套的 options 列表

options 对象最终看起来像 { delay: "list(show = 1000, hide = 3000)"}

不幸的是,shinyBS 似乎不再维护,或者提交修复程序是值得的。

我会建议一个解决方法 - 使用 shinyBS::addTooltip 正确序列化 options

require(shiny)
require(shinyBS)

shinyApp(
ui = fluidPage(
# shinyjs::useShinyjs(),
shinyBS:::shinyBSDep,

sidebarLayout(
sidebarPanel(
selectInput(inputId = 'input', label = 'input', choices = c('cats','dogs'))
),
mainPanel()
)
),
server = function(input, output, session) {
addTooltip(session, id = 'input', title = "Lets delay this appearing for 1s and force disappear after 5s",
placement = "bottom", trigger = "hover", options = list(delay = list(show=1000, hide=3000)))
}
)

或者直接使用 Bootstrap。

关于r - 延迟和终止 shinyBS::bsTooltip,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47477237/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com