我想做一个闪亮的应用程序与文字云。但是,当鼠标悬停在单词上时,我在更改结果时遇到了问题。我想要的是,当鼠标悬停在单词上时,用户的鼠标会变成一个指针。
根据here和here的回答,我尝试将它放在某种css类中(实际上并不知道我做了什么)。
#in the body ui
(tags$head(tags$style(HTML('div#wcLabel {cursor: pointer;}')))但它并没有起作用。
下面是一个可重复使用的示例
library(shiny)
library(wordcloud2)
# Global variables can go here
n <- 1
# Define the UI
ui <- bootstrapPage(tags$head(
tags$style(HTML('div#wcLabel {cursor: pointer;}'))
),
numericInput('size', 'Size of wordcloud', n),
wordcloud2Output('wordcloud2')
)
# Define the server code
server <- function(input, output) {
output$wordcloud2 <- renderWordcloud2({
# wordcloud2(demoFreqC, size=input$size)
wordcloud2(demoFreq, size=input$size)
})
}
# Return a Shiny app object
shinyApp(ui = ui, server = server)我知道在wordcloud2()函数中有一个调用hoverFunction =,我想我必须在里面放一些东西来实现我的目标,但是我不知道是什么。
任何帮助都将不胜感激。非常感谢!
弗雷德里克
发布于 2021-04-24 03:35:06
#wcLabel默认设置了pointer-events: none;。您可以使用!important规则来覆盖它。
div#wcLabel {cursor: pointer; pointer-events: auto !important;}https://stackoverflow.com/questions/67202256
复制相似问题