1.0.5 • Published 19 days ago

popper-plugin v1.0.5

Weekly downloads
-
License
ISC
Repository
-
Last release
19 days ago

Popper Plugin

A javascript plugin for popper which could be used to positioning tooltip or popover

Install

npm install --save popper-plugin

Import file

<script src="node_modules/popper-plugin/dist/popper.min.js"></script>

Initialize plugin

const samplePopper = new PopperComponent({
  /** Refer below for available properties */
});

Properties

NameTypeDefault valueDescription
$popperEleElementPopper element
$triggerEleElementTrigger element
$arrowEleElementArrow icon in the popper
positionNumberautoPosition of popper (top, bottom, left, right, auto)
marginNumber8Space between popper and its activator (in pixel)
offsetNumber5Space between popper and window edge (in pixel)
enterDelayNumber0Delay time before showing popper (in milliseconds)
exitDelayNumber0Delay time before hiding popper (in milliseconds)
showDurationNumber300Transition duration for show animation (in milliseconds)
hideDurationNumber200Transition duration for hide animation (in milliseconds)
transitionDistanceNumber10Distance to translate on show/hide animation (in pixel)
zIndexNumber1CSS z-index value for popper
afterShowFunctionCallback function to trigger after show
afterHideFunctionCallback function to trigger after hide

Methods

show()

/**
 * @prop {boolean} [resetPosition] - Recalculate position before show
 * @prop {object} [data] - Any custom data which would be passed to afterShow callback function call
 */
samplePopper.show({});

hide()

/**
 * @prop {object} [data] - Any custom data which would be passed to afterHide callback function call
 */
samplePopper.hide({});

updatePosition()

To recalculate the position of the popper element. Which colud be used when scrolling the parent element.

samplePopper.updatePosition();
1.0.5

19 days ago

1.0.2

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago