Skip to content

Instantly share code, notes, and snippets.

@mageddo
Last active July 23, 2017 17:25
Show Gist options
  • Select an option

  • Save mageddo/9e1fb48de8b4a3a3f84229331ecca042 to your computer and use it in GitHub Desktop.

Select an option

Save mageddo/9e1fb48de8b4a3a3f84229331ecca042 to your computer and use it in GitHub Desktop.
Tooltip customizado com javascript
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="robots" content="noindex, nofollow">
<meta name="googlebot" content="noindex, nofollow">
<link rel="stylesheet" type="text/css" href="https://rawgit.com/iamceege/tooltipster/4.2.5/dist/css/tooltipster.bundle.min.css">
<link rel="stylesheet" type="text/css" href="https://rawgit.com/louisameline/tooltipster-follower/0.1.5/dist/css/tooltipster-follower.min.css">
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.js"></script>
<script type="text/javascript" src="https://rawgit.com/iamceege/tooltipster/4.2.5/dist/js/tooltipster.bundle.min.js"></script>
<script type="text/javascript" src="https://rawgit.com/louisameline/tooltipster-follower/0.1.5/dist/js/tooltipster-follower.min.js"></script>
<style type="text/css">
* {
font-family: Ubuntu, Courier New
}
.templates {
display: none;
}
</style>
<title>Custom Tooltip JavaScript and jQuery</title>
<script type="text/javascript">
$(function() {
// tooltip simples
$('.tooltip').tooltipster();
// seguindo o mouse
$('.follow-image').tooltipster({
plugins: ['follower'],
theme: 'tooltipster-light',
delay: 50
});
// seguindo o mouse com conteudo customizado
$('.follow-image-custom-content').tooltipster({
content: $('.custom-content'),
plugins: ['follower'],
theme: 'tooltipster-light',
delay: 50
});
});
</script>
</head>
<body>
<h3>Tooltip simples</h3>
<img src="https://dummyimage.com/200/000/ccc" class="tooltip tooltipstered" title="Tooltip Simples">
<br>
<h3>Seguindo o mouse</h3>
<img src="https://dummyimage.com/200/000/ccc" class="follow-image tooltipstered" title="Tooltip seguindo o mouse">
<h3>Seguindo o mouse com conteúdo customizado</h3>
<img src="https://dummyimage.com/200/000/ccc" class="follow-image-custom-content tooltipstered">
<div class="templates">
<div class="custom-content">
<img src="https://dummyimage.com/50/000/ff0000"> Conteúdo customizado
</div>
</div>
<h2>Mais exemplos</h2>
<ul>
<li><a href="http://iamceege.github.io/tooltipster/#demos">Página com exemplos</a></li>
<li><a href="http://iamceege.github.io/tooltipster/doc/js/scripts.js">Código JS</a></li>
<li><a href="view-source:http://iamceege.github.io/tooltipster/">Código HTML</a></li>
<li><a href="http://iamceege.github.io/tooltipster/#styling">documentação</a></li>
</ul>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment