Tiny, reusable popover component
npm install popoverTake a look at test/test.html or the demo site for examples. Both use the entirely optional themed version, so don't let that fool you ;-).
```
npm install --save popoverpopover.built.js
or download
Get it in your page either by script tag or module loader/browserify.
You'll also need at least popover.css or style them yourself.
`javascript`
var popover = new Popover({
button: document.querySelector('#triggering-button'),
position: 'left|top|right|bottom',
className: 'optional space-delimited css-classes',
align: 'left|top|right', // optionally aligns popover relative to button
template: 'HTMLString|DOMElement' // optional
})
popover.render()
- popover.setButton('String|DOMElement'): Attaches popover to given elementpopover.setContent('String|HTMLString|DOMElement')
- : Sets the content of the popoverpopover.render()
- : Renders, positions and displays the popoverpopover.remove()
- : Removes the popover from the DOMpopover.el
- : The popover DOM element
The methods are chainable. So, for example popover.setContent('foo').setButton('#button').render().el will work.
- shown the popover is shownremoved
- the popover is removed
Standard template:
`html`
If you're passing in a custom template, at least .popover-content has to be present.popover-theme.css`.
The popover comes with minimal styles, feel free to adapt it to your needs. For your convenience
there is a themed version in