npm.io
0.5.0 • Published 9 years ago

micro-popover

Licence
MIT
Version
0.5.0
Deps
2
Vulns
0
Weekly
0
Stars
3

micro-popover

A tiny, fast, configurable popover in 2.5kb. Demo

js-standard-style

Usage

import Popover from 'micro-popover'

const target = document.getElementById('target')

const pop = new Popover({
  target: target,
  popover: `
    <div class="my-popover">
      <h5 class="mv0">I'm a popover!</h5>
    </div>
  `,
  position: 'left',
  transitionSpeed: 200, // for css transitions
  onChange: ({ pinned }) => {...} // boolean
})

target.addEventListener('mouseenter', pop.pin)
target.addEventListener('mouseleave', pop.unpin)

Required CSS:

.micro-popover {
  position: absolute;
  z-index: 9999;
  top: 0; left: 0;
}

MIT License

Keywords