我希望小部件在鼠标光标悬停于其上方之前是不可见的。
使用Shinyjs,当光标进入“区域”时,我可以使小部件显示/隐藏。但是,我想将小部件放置在Area中。这可能吗?
据我所知:
library(shiny)
library(shinyjs)
shinyApp(
ui = fluidPage(
useShinyjs(),
p(id="Area","Area"),
selectInput("A_widget", label = "A widget", choices=c("None"), selected="None")
),
server = function(input, output) {
shinyjs::hide("A_widget")
onevent("mouseenter", "Area", shinyjs::show("A_widget"))
onevent("mouseleave", "Area", shinyjs::hide("A_widget"))
}
))
我想要类似这样的伪代码,将鼠标悬停在“区域”上的小部件上:
library(shiny)
library(shinyjs)
shinyApp(
ui = fluidPage(
useShinyjs(),
p(id="Area", selectInput("A_widget", label = "A widget", choices=c("None"), selected="None"))
),
server = function(input, output) {
shinyjs::hide("A_widget")
onevent("mouseenter", "Area", shinyjs::show("A_widget"))
onevent("mouseleave", "Area", shinyjs::hide("A_widget"))
}
))
我想要一个鼠标悬停出现的小部件。谢谢!
答案 0 :(得分:2)
使用尺寸为div的
library(shiny)
library(shinyjs)
shinyApp(
ui = fluidPage(
useShinyjs(),
div(id="Area", style = "width:300px;height:50px",
selectInput("A_widget", label = "A widget", choices=c("None"), selected="None"))
),
server = function(input, output) {
shinyjs::hide("A_widget")
onevent("mouseenter", "Area", shinyjs::show("A_widget"))
onevent("mouseleave", "Area", shinyjs::hide("A_widget"))
}
)