将鼠标悬停在单词上时在框中显示文本

问题描述 投票:0回答:2

我想将鼠标悬停在单词上时显示 R markdown 文件中单词的定义。

对于链接,可以这样完成:

[I'm an inline-style link with title](https://www.google.com "Google's Homepage")
将鼠标悬停在
I'm an inline-style link with title
上时,将弹出文本
Google's Homepage
。但是,我想对一个单词做同样的事情,并在没有链接的框中给出该单词的定义。

类似:

[word]("Definition of word that pops up in a box upon hovering")
。这可能吗?

html r r-markdown
2个回答
6
投票

一个选项是

tippy
套餐。

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(tippy)
```

This is a 
```{r echo = FALSE}
tippy("word.", tooltip = "Definition of word that pops up in a box upon hovering")
```
I would like to know its definition.


6
投票

在这里找到解决方案

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

# Introduction to tooltip or popups

This is a <abbr title="Definition of word that pops up in a box upon hovering">word.</abbr> I would like to know its definition.

如果能够更改工具提示就好了。

此网页可以帮助您自定义标签(使用 HTML 缩写标签缩写您的代码)。

我也在寻找一种拥有维基百科悬停框样式的方法。

同样,当您将鼠标悬停在文本上时,您可以避免出现“默认”框并根据需要进行更改:此网站提供了修改“工具提示”框的示例。

© www.soinside.com 2019 - 2024. All rights reserved.