Install
npm i popup-simple
<button class="btn js-popup-open" data-popup-target="popup-name">open popup</button>
<div class="popup js-popup" data-popup="popup-name">
<div class="popup__inner">
<button class="popup__close js-popup-close"></button>
</div>
</div>
<a href="#popup-name" class="btn js-popup-open">open popup</a>
<div id="popup-name" class="popup js-popup">
<div class="popup__inner">
<button class="popup__close js-popup-close"></button>
</div>
</div>
<a
href="#popup-name"
class="btn js-popup-open"
data-toggle-btn-class="btn"
>open popup</a>
<div
id="popup-name"
class="popup js-popup"
data-close-on-overlay-click="false"
data-escape-handler="false"
>
<div class="popup__inner">
<button class="popup__close js-popup-close"></button>
</div>
</div>
import Popup from 'popup-simple'
const popup = new Popup()
popup.init()
Options
Standart options
{
preventScroll: true,
escapeHandler: true,
closeOnOverlayClick: true,
toggleBtnClass: false,
}
Methods
popup.onOpen = () => {
};
popup.onCLose = () => {
};
popup.openTarget(target)
popup.closeAll()
popup.destroy()