Last active
September 1, 2017 22:17
-
-
Save paulbounce/b16fc65b8e1fe65a450eca98a92f7bdc to your computer and use it in GitHub Desktop.
Hover Tooltips in Unbounce with Tippy.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
// Tippy.js in Unbounce - Tool Tippy-fying your Pages. Version 0.1 | |
// The buttons you want to add tooltips to. Enter the ID of your button, | |
// followed by the text you want to pop up. Add additional buttons in the | |
// same format if wanted/needed | |
var buttons = [ | |
['lp-pom-button-11', 'The text for this tooltip'], | |
['lp-pom-button-12', 'The text for this other tooltip'] | |
]; | |
// Don't touch this, except for 'theme', which can be 'light', 'dark', | |
// or 'transparent'. You can also create your own themes if you're crafty: | |
// https://atomiks.github.io/tippyjs/#creating-themes | |
for (let item of buttons) { | |
var button = item[0]; | |
var text = item[1]; | |
document.getElementById(button).setAttribute("title", text); | |
tippy('#' + button, { | |
theme: 'light' | |
} | |
); | |
} | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link rel="stylesheet" href="https://unpkg.com/tippy.js@1.2.0/dist/tippy.css"> | |
<script src="https://unpkg.com/tippy.js@1.2.0/dist/tippy.js"></script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment