Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

67 lines (59 sloc) 2.235 kb
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Smooth animated tooltip</title>
<link rel="stylesheet" type="text/css" media="screen" href="css/s.css" />
</head>
<body>
<div class="box">
<a href="#open"><span>&#83;</span><span >&#123;</span></a>
<div class="tooltip">
<ul>
<li><a href="#">Help</a></li>
<li><a href="#">Settings</a></li>
<li><a href="#">Logout</a></li>
</ul>
</div>
</div>
<a href="https://github.com/Victa/smooth-animated-tooltip">fork the source on github</a>
<a href="http://dribbble.com/shots/347874-Smooth-animated-tooltip">view dribbble post</a>
<!-- JS -->
<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script>
$(function() {
// A bit of jQuery to open/close the tooltip
var $tooltip = $('.tooltip'),
$box = $('.box');
$box.delegate('[href="#open"]', 'click', function(e) {
e.preventDefault();
var $this = $(this);
$this.toggleClass('active');
$tooltip.toggleClass('active');
if($tooltip.hasClass('active')) {
$(document).bind('click.closetooltip', function(e) {
if($(e.target).parents('.box').length === 0) {
$this.removeClass('active');
$tooltip.removeClass('active');
$(document).unbind('click.closetooltip');
}
});
} else {
$(document).unbind('click.closetooltip');
}
});
});
</script>
<!-- GA -->
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-22043471-2']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.