@lovata/popup-helper

1.0.1 • Public • Published

Popup helper package

installation

npm install @lovata/popup-helper

Initialization

import PopupHelper from '@lovata/popup-helper';
@import '@lovata/popup-helper/css/popup-helper';

This css allows for work with only 2 viewport types: mobile (less then 769px) and desktop. If you want change it so you should use changeNoScrollSelector() method

Methods

changeNoScrollSelector()

Change class for scroll disabling

saveScrollPosition()

Return scroll position

setScrollPosition()

Save scroll position before modal opening

setBodyScrollState(needScroll)

Complex method. Depending @param needScroll toggle class on body, save or set scroll position and padding to avoid shifting content

Param Type
needScroll boolean

focusTrapManager(needTrap, modal)

Param Type Description
needTrap boolena if true - enable focus trap
modal node node of modal window

getScrollBarWidth()

Returns: scrollBar width (type: int)

setBodyPadding()

Set css custom-property equal scrollbar width

checkOverlay() boolean

Return false if overlay was create

overlayController(needOverlay)

Ff @param needOverlay is true create Node for overlay, else remove it

Param Type
needOverlay boolean

overlayHandler(isInit, closeBtnNode, modalNode)

Complex method. Create of remove overlay and if **@param isInit** is true, so set flags and **click** and **esc button press** handlers

Param Type
isInit boolean
closeBtnNode node
modalNode node

createOverlay()

Create overlay node

removeOverlay()

Remove overlay node

getOverlay()

Returns: overlay node

overlayClickHandler(triggerTarget)

Add 'click' handler to overlay

Param Type Description
triggerTarget node Node for close modal window

escPressHandler(triggerTarget, modalNode)

Add esc button press handler

Param Type Description
triggerTarget node Node for close modal window
modalNode node Node of modal window

License

© 2019, LOVATA Group, LLC under GNU GPL v3.

Developed by Uladzimir Ambrazhei.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.1
    6
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.1
    6
  • 1.0.0
    0
  • 0.3.0
    0

Package Sidebar

Install

npm i @lovata/popup-helper

Weekly Downloads

0

Version

1.0.1

License

GPL-3.0-or-later

Unpacked Size

43.3 kB

Total Files

5

Last publish

Collaborators

  • lautsevich
  • andrey_kharanenka