0.0.3 • Published 6 years ago

@dbvis/vd-tooltip v0.0.3

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

VdTooltip

A simple library to attach a tooltip to elements. The attachment is handled by the awesome tether library.

Sample usage:

import { VdTooltip } from '@dbvis/vd-tooltip';

//add the tooltip to the body
const tooltip = new VdTooltip(document.body)

const hoverMeDiv = document.getElementsByTagName('div')[0]

hoverMeDiv.addEventListener('mouseover', () => {
  //set the content and attach the tooltip to the div
  tooltip.setContent('Example', 'Hello <em>world!</em>').show(hoverMeDiv)
})

hoverMeDiv.addEventListener('mouseleave', () => {
  tooltip.hide()
})