Skip to content

Instantly share code, notes, and snippets.

@paulbounce
Last active September 1, 2017 22:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paulbounce/b16fc65b8e1fe65a450eca98a92f7bdc to your computer and use it in GitHub Desktop.
Save paulbounce/b16fc65b8e1fe65a450eca98a92f7bdc to your computer and use it in GitHub Desktop.
Hover Tooltips in Unbounce with Tippy.js
<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>
<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