We wanted a super simple, zero config options, declarative tooltip library with no dependencies. We couldn't find one, so we wrote our own.
Just use bower to install.
$ bower install kawo-tooltip
require.config({
paths: {
kawoTooltip: '../bower_components/kawo-tooltip/dist/kawo-tooltip.min'
}
});
require( [ 'kawoTooltip' ], function() {
});
<script src="./bower-components/kawo-tooltip/dist/kawo-tooltip.min.js"></script>
Simply add the attribute data-tooltip
to any element on which you wish to display a tooltip.
<p data-tooltip="Text to display">This tooltip works on almost any HTML element.</p>
If you want to customise kawo-tooltip you can build your own minified version using uglifyjs
.
$ uglifyjs kawo-tooltip.js -c -m -o dist/kawo-tooltip.min.js