Wordcloud2-将鼠标悬停在单词上时,将光标更改为指针 [英] Wordcloud2 - change the cursor to pointer, when hover over words

查看:90
本文介绍了Wordcloud2-将鼠标悬停在单词上时,将光标更改为指针的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用Wordcloud制作一个闪亮的应用程序.但是当鼠标悬停在单词上时,我在更改结果时遇到问题.我想要的是,当用户的鼠标悬停在单词上时,它会变成一个指针.

I want to make a Shiny App with a Wordcloud. But I'm having problems on changing the outcome, when the mouse hovers over the Words. What I want is, that the mouse of the user changes to a pointer, when it hovers over the words.

根据此处

#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 = ,我想我必须在其中放一些东西才能实现我的目标,但我不知道.

I know that there is a call hoverFunction = in the wordcloud2() function, and I guess, I would have to put something in there, to achieve my goal, but I don't know what.

任何帮助将不胜感激.非常感谢!

Any help would be really appreciated. Many Thanks!

弗雷德里克

推荐答案

#wcLabel默认情况下设置了 pointer-events:none; .您可以使用!important 规则来覆盖它.

#wcLabel has pointer-events: none; set by default. You can override that by using the !important rule.

div#wcLabel {cursor: pointer; pointer-events: auto !important;}

这篇关于Wordcloud2-将鼠标悬停在单词上时,将光标更改为指针的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆