Skip to content

Latest commit

 

History

History
26 lines (16 loc) · 814 Bytes

README.md

File metadata and controls

26 lines (16 loc) · 814 Bytes

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