【问题标题】:R Shiny tooltip css not being appliedR Shiny tooltip css没有被应用
【发布时间】:2021-04-20 08:44:56
【问题描述】:

我正在尝试向 R Shiny 应用程序添加工具提示。我使用 bsplus 而不是 shinyBS 来实现它,因为它与包 shinyWidgets 有明显的冲突。

我发现我无法设置工具提示的样式(它们非常小)。我发现的一切都与使用 shinyBS 的人有关——但这些解决方案在使用 bsplus 时不起作用。

下面提供了一个简单的表示。谁能告诉我在设置工具提示样式方面我做错了什么?

谢谢!

library(shiny)
library(bsplus)

ui <-

  fluidPage(
    bsplus::use_bs_tooltip(),

    tags$style(HTML(".tooltip .tooltiptext { visibility: hidden; background-color: blue; }
                    .tooltip:hover .tooltiptext { visibility: visible; }")),

    sidebarLayout(

      sidebarPanel(

        numericInput(inputId = "id_num", label = "Test numeric input", value = 0.5, min = 0, max = 1, step = 0.05) %>%
          bs_embed_tooltip("My tooltip text", delay = "dseconds(0)", placement = "right")

      ),

      mainPanel()
    )
  )


server <- function(input, output) { }

shinyApp(ui = ui, server = server)

【问题讨论】:

    标签: css r shiny tooltip


    【解决方案1】:

    您忘记在 UI 中添加 bsplus::use_bs_tooltip(),将其添加到您的 fluidpage

    更新

    那是你的系统或浏览器问题,我运行上面的代码没有错误。

    【讨论】:

    • 很好 - 是的,我有。但是,这对不应用 css 没有帮助...
    • 我不相信它 - 工具提示不是蓝色的,就像在 css 中指定的那样
    • 因为你的CSS选择器不对,需要是".tooltip .tooltip-inner"
    猜你喜欢
    • 2020-08-15
    • 1970-01-01
    • 1970-01-01
    • 2019-06-10
    • 1970-01-01
    • 1970-01-01
    • 2018-02-13
    • 2018-07-05
    • 2019-06-30
    相关资源
    最近更新 更多