Replies: 3 comments
-
I didn't find how to do it so I decided to switch to an article instead that I display/hide on hover. Here's the code if someone's interested. document.addEventListener('DOMContentLoaded', function () {
const hint = document.querySelector('a#tooltip-hint');
hint.addEventListener('mouseenter', toggleTooltip);
hint.addEventListener('mouseleave', toggleTooltip);
});
function toggleTooltip(event) {
const tooltip = document.querySelector('article#tooltip');
tooltip.style.display = (tooltip.style.display === 'block') ? 'none' : 'block';
} article#tooltip {
display: none;
font-size: 0.875em;
} <a id="tooltip-hint" href="#">?</a>
<article id="tooltip">
Lorem ipsum sin amet
</article> |
Beta Was this translation helpful? Give feedback.
0 replies
-
I was thinking the same. Tried <br> and \n but no dice. Would be a good addition. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Not directly a solution but for me using data-placement="left" / data-placement="right" helped to keep the tooltip visible. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
How does one add a line break inside a tooltip? I've tried both
\n
and<br>
without success.Here's my code sample:
Beta Was this translation helpful? Give feedback.
All reactions