npm i poppingjs
import Popping from "poppingjs"import { PoppingFlip } from "poppingjs/modifiers"import { PoppingScroll, PoppingResize } from "poppingjs/plugins"
we are getting started using poppingjs.
<div class="popping-container" id="getting-started"><imgclass="popping-center"src="/images/icons/icon-96x96.png"alt="beard-guy"width="96"height="96"/><div class="popping n-bg">mytabworks</div></div>
when one of the parent or ancestor element has position: relative; that will be the base of the tooltip positioning or else it will be the html element itself.
you can create your own plugin.
<div class="popping-container n-flat" id="pop-create-plugin"><imgclass="popping-center"src="/images/icons/icon-96x96.png"alt="beard-guy"width="96"height="96"draggable={false}/><div class="popping n-bg-intense">Drag me</div></div>
to enable flipping you must apply PoppingFlip to the modifiers
<div class="popping-container n-flat" id="pop-flipping"><imgclass="popping-center"src="/images/icons/icon-96x96.png"alt="beard-guy"width="96"height="96"draggable={false}/><div class="popping n-bg-intense">Drag me to edges</div></div>
by applying PoppingScroll(to update the dialog on every scroll) into the plugins and setting the option allowPersistent into true
<div class="popping-container popping-scroll n-flat" id="pop-persistent"><div style="height: 1000px; width: 1000px"/><div class="text-center"><img width="96" height="96" src="/images/icons/icon-96x96.png" alt="beard-guy"/></div><div class="popping n-bg-intense">Scroll me</div><div style="height: 1000px"/></div>
animating to popping when hovering or clicking.
<div class="popping-container n-flat" id="pop-animated" data-example><imgclassName="popping-center"src="/images/icons/icon-96x96.png"alt="beard-guy"width="96"height="96"/><div class="popping popping-animated n-bg-intense">you can see me</div></div>
API
Argument Argument | Type Type | Default Default | Description Description |
|---|---|---|---|
| Popping.create( | |||
| target | element | node | - | the element you want to place your dialog. |
| dialog | element | node | - | it is the element of tooltip dialog suppose to be pops next to the target. |
| options | object | - | the options of the popping |
| ) | |||
Method Method | Return Return | Default Default | Description Description |
|---|---|---|---|
| Instance.updatePosition | void | - | it is use to update the position of the tooltip dialog. |
| Instance.updateOptions | void | - | it is use to update options. |
| Instance.destroy | void | - | it is use to destroy and kill the eventListeners. |