native-popover
v1.1.0
Published
Basic vanilla js enhancement for native popover
Downloads
3
Maintainers
Readme
native-popover
No dependencies, basic vanilla js enhancement for browser popover API.
Installation
npm install native-popover --save
Configuration
Library provides additional features such as:
- reacting to window resize
- selecting popover placement
- calculating position of popover in relation to trigger element placement
Except standard attributes from native API (such us popover), trigger element can accept data-position
attribute.
Available values:
bottom, bottom-right, bottom-left, top, top-left, top-right, left, right
.
Example
<body>
<button popovertarget="mypopover">OPEN POPOVER</button>
<div id="mypopover" popover data-position="bottom-right">
POPOVER BODY
</div>
</body>
import init as nativePopoverInit from "native-popover";
window.addEventListener("DOMContentLoaded", nativePopoverInit);