1.1.5 • Published 8 years ago

toolpip v1.1.5

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

tooltip

simple pure javascript tooltip

How to use

import Tooltip from 'toolpip';

let tooltip = new Tooltip(document.body, {type: 'help'}); // node to attach

tooltip.position(document.querySelector('.node-to-pin-tooltip-to')); // calculate layout position of tooltip nearby to passed element

tooltip.show();

API Reference

tooltip.show() opens a tooltip

tooltip.hide() hides it

tooltip.position(node, direction) Calculates the position of tooltip relative to passed node. Default positioning is «top» which means the tooltip to be appeared on the top of the element. Also can be «right» and «bottom»

tooltip.updateContent(titleText, subtitleText) Changes title and subtitle text content of tooltip

Options

{type: 'help'} Adds «help» class to tooltip element