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>
import Popup from 'popup-simple'
const popup = new Popup()
popup.init()
Options
Standart options
{
toggleBodyClass: true,
escapeHandler: true,
closeOnOverlayClick: true,
toggleBtnClass: false,
}
Methods
popup.onOpen = () => {
};
popup.onCLose = () => {
};
popup.openTarget(target)
popup.closeAll()
popup.destroy()