r - 延迟和终止 shinyBS::bsTooltip

标签 r shiny shinybs

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

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/

相关文章:

css - 调整 Shiny 进度条的大小并将其居中

r - Valuebox 未显示 - Shiny 的仪表板

javascript - shinyBS - 拖动时删除工具提示

shiny - 我怎么能不在 Shiny 的 UI 中包含 bootstrap css

r - 与 Ruby on Rails 等另一种 Web 编程语言相比,Shiny 应用程序的局限性是什么?

r - 使用shinyBS包中的bsModal和plotly R的plotly_click在弹出窗口中生成新图

r - 如何使用在hclust中使用的变量创建向量

r - 使用 rvest(抓取)包然后清理文本

r - 在 shinydashboard 中显示/隐藏 menuItem

r - 顶部位置的图例未显示