From eb5962da9ecdbdd4e533b426da35828e998a50c9 Mon Sep 17 00:00:00 2001 From: avahoffman Date: Thu, 17 Jul 2025 17:07:54 -0400 Subject: [PATCH 1/2] Update AOU_ethics.qmd --- module/AOU_ethics.qmd | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/module/AOU_ethics.qmd b/module/AOU_ethics.qmd index 54aee333..40cac019 100644 --- a/module/AOU_ethics.qmd +++ b/module/AOU_ethics.qmd @@ -26,3 +26,12 @@ These ethics-related questions can be added on to any activity that leverages th - [Google Doc](https://docs.google.com/document/d/1Xi1M9icJUJ2pfxp5pOV4yzQUHfQCM8zo/edit?usp=sharing&ouid=116032995747974603894&rtpof=true&sd=true) - Answer key available [here](https://docs.google.com/document/d/16GiVCWKhVxkKzOUr6XlQ_vdj-tyxBYlIa3lmstzf38Y/edit?usp=sharing). Please message Ava Hoffman (ahoffma2 at fredhutch dot org) to get access. + +```{r} +#| echo: false +tt <- function(x, y) { + paste0('',x,'') +} +``` + +This is some random text with a tooltip `r tt("here","This is great")` and a tooltip `r tt("there","Fantastic")`. From 083912c0e13b30a01fef9a90102f06284e383677 Mon Sep 17 00:00:00 2001 From: avahoffman Date: Thu, 17 Jul 2025 17:22:42 -0400 Subject: [PATCH 2/2] Try an html approach? --- module/AOU_ethics.qmd | 4 +++- styles.css | 45 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 1 deletion(-) diff --git a/module/AOU_ethics.qmd b/module/AOU_ethics.qmd index 40cac019..701f88fe 100644 --- a/module/AOU_ethics.qmd +++ b/module/AOU_ethics.qmd @@ -34,4 +34,6 @@ tt <- function(x, y) { } ``` -This is some random text with a tooltip `r tt("here","This is great")` and a tooltip `r tt("there","Fantastic")`. +
Hover over me + SECRET TIP +
diff --git a/styles.css b/styles.css index 1812c01b..f70c1b98 100644 --- a/styles.css +++ b/styles.css @@ -36,4 +36,49 @@ background-color: RoyalBlue; } +/* Tooltip container */ +.tooltip { + position: relative; + display: inline-block; + border-bottom: 1px dotted black; /* If you want dots under the hoverable text */ +} + +/* Tooltip text */ +.tooltip .tooltiptext { + visibility: hidden; + width: 120px; + background-color: #555; + color: #fff; + text-align: center; + padding: 5px 0; + border-radius: 6px; + /* Position the tooltip text */ + position: absolute; + z-index: 1; + bottom: 125%; + left: 50%; + margin-left: -60px; + + /* Fade in tooltip */ + opacity: 0; + transition: opacity 0.3s; +} + +/* Tooltip arrow */ +.tooltip .tooltiptext::after { + content: ""; + position: absolute; + top: 100%; + left: 50%; + margin-left: -5px; + border-width: 5px; + border-style: solid; + border-color: #555 transparent transparent transparent; +} + +/* Show the tooltip text when you mouse over the tooltip container */ +.tooltip:hover .tooltiptext { + visibility: visible; + opacity: 1; +}