简体   繁体   English

在 R Shiny 的图标上添加 hover 消息

[英]Add hover message on icon in R Shiny

I would like to add a hover message which will appear when I move my mouse above the "i" information icon.我想添加一条 hover 消息,当我将鼠标移到“i”信息图标上方时,该消息将出现。

info icon信息图标

I added the icon with:我添加了图标:

numericInput("fixed_ratio", 
             label = tags$div(HTML('Fixed ratio <i class="fas fa-info-circle" 
                                       style = "color:#0072B2;"></i>')), 
             value = 1)

Within the "HTML", I tried to add "title" to work as the hover message, but it didn't work out.在“HTML”中,我尝试添加“标题”作为 hover 消息,但没有成功。

Is there any way to add the message?有什么方法可以添加消息吗? Thanks!!谢谢!!

This works for me:这对我有用:

library(shiny)

ui <- fluidPage(
  numericInput(
    "fixed_ratio", 
    label = tags$span(
      "Fixed ratio", 
      tags$i(
        class = "glyphicon glyphicon-info-sign", 
        style = "color:#0072B2;",
        title = "message"
      )
    ), 
    value = 1
  )  
)

shinyApp(ui, function(input, output){})

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM