Show text in a box when hovering over word

Viewed 1518

I would like to show a definition of a word in a R markdown file when hovering over a word.

For a link it can be done like this: [I'm an inline-style link with title](https://www.google.com "Google's Homepage") Upon hovering over I'm an inline-style link with title the text Google's Homepage will pop up. However, I would like to do the same for a word and give the definition of the word in a box without the link.

Something like: [word]("Definition of word that pops up in a box upon hovering"). Is this possible?

2 Answers

One option is the tippy package.

```{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.

enter image description here

Found a solution here.

```{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.

Would be nice to be able to change the tooltip.

This webpage can help you customize the tag.

I'm also looking of a way to have a Wikipedia hover box style.

Again, you can avoid the 'default' box when you hover the text and change it as you like: this website provides examples to modify your 'tooltip' box.

Related