
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
Modaling is a simple and lightweight implementation of pop-ups, written in pure JavaScript and does not contain external dependencies
Modaling is a simple and lightweight implementation of pop-ups, written in TypeScript and does not contain external dependencies
npm install --save modaling
yarn add modaling
Add this HTML on your page
<div class="js-modal"> <!-- whole modal container -->
<div class="js-overlay"> <!-- overlay -->
<div class="modal-container"> <!-- modal content -->
<button class="js-close"></button> <!-- close button -->/
</div>
</div>
</div>
And this HTML for open button
<button class="js-open">Open modal</button>
Next import Modaling into your JS file and initialize it
import Modaling from "modaling";
const modal = new Modaling({
standardStyles: true // send this parameter for auto setting styles
})
All the parameters are includes by default but you can change some of them just send it as an object
debug Boolean
truestandardStyles Boolean || [ String ]
falsemodal - the whole modal blockmodalContainer - modal content containeroverlay - overlay of the modalopen - the opener elementclose - the closer elementactiveClass - include the modal show classkeys [ String ]
['Escape']"key" or "code" propertieskeyClose Boolean
truefalse, close by key will not be applied in any waysopenByMethod Boolean
false.open()closeByMethod Boolean
false.close()autoInit Boolean
true.init() methodautoOpen Number || Boolean
falsefalse if you want to disable auto openautoClose Number || Boolean
falsefalse if you want to disable auto closescrollLocking Boolean
truefalse, the scroll lock will not be applied in any waysmodal String
.js-modalmodalContainer String
.modal-containeropener String
.js-opencloser String
.js-closecloser. It has it's own parameteroverlay String
.js-overlayactiveClass String
modal_showscrollLockClass String || Boolean
falsedocument.bodyenablePadding Boolean
truefalse, page content will not padding right when modal opensYou can send the parameters initCallback, openCallback, closeCallback. Each of them is an object containing two keys before and after. before runs before action, after - after. Read more in the Examples section
.on(listener, callback)
.set(prop, value)
Parameters block.open()
false arg.close()
false arg.toggle()
.init(parentContainer)
parentContainer element.isOpened
boolean.hasEventListeners
boolean.openedPopup
DOM NodeisOverflow
booleanisInitialized
booleanYou don't have to send a callback as a parameter. You can listen to this event via the .on() method. There are many more event listeners than when passed as parameters
if you send a callback as a parameter and listen for exactly the same event, they will both trigger. Firstly will be triggered the parameter then the listener
'openstart'
'openend'
'closestart'
'closeend'
'resize'
const modal = new Modaling({
standardStyles: ['modal'], // standard styles will apply just to 'modal' element
opener: '[data-open="alert-modal"]',
scrollLockClass: 'overflow-hidden', // this will be ignored because scrollLocking parameter is sended
scrollLocking: false,
modal: '.alert-modal',
initCallback: {
before: function() {
alert('modal is started init')
}
after: function() {
alert('modal inited')
}
}
})
const modal = new Modaling()
alert(modal.isOpened) // return false
modal.open()
alert(modal.isOpened) // return true
FAQs
Modaling is a simple and lightweight implementation of pop-ups, written in pure JavaScript and does not contain external dependencies
We found that modaling demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.