jpopup is a super small JavaScript popup plugin that allows to display any HTML element in a responsive fullscreen modal window.
# NPM $ npm install jpopup # Bower $ bower install jpopup
1. Import the jpopup’s JavaScript and CSS files into the document.
// As A Module import jPopup from 'jPopup';
<link href='css/index.min.css' rel='stylesheet'> <script src="js/index.min.js"></script>
2. Create a new jPopup and define your own content to be displayed in the popup.
var jPopupDemo = new jPopup({
content: 'any html content here'
}); 3. Determine the transition effects: ‘fade’ (default), ‘slideInFromTop’, ‘slideInFromBottom’, ‘slideInFromLeft’, or ‘slideInFromRight’.
var jPopupDemo = new jPopup({
transition: 'fade'
}); 4. Callback functions.
var jPopupDemo = new jPopup({
onOpen: function ($popupEl) {
console.log($popupEl, 'open');
},
onClose: function ($popupEl) {
console.log($popupEl, 'close');
}
}); Open/close the popup manually:
jPopupDemo.open(); jPopupDemo.close();
Set & update popup content:
jPopupDemo.setContent(content); jPopupDemo.getContent();
Destroy the instance.
jPopupDemo.destroy();
Customize the popup in the SASS:
// Base Breakpoint $baseBreakpoint: 680px; // Background Color $bgColor: #fff; // Close Button Color $closeBtnColor: #adadad;
v2.0.1 (06/20/2025)
v2.0.0 (05/31/2020)
01/02/2020
09/29/2018
The post Lightweight Fullscreen Popup Library – jpopup appeared first on CSS Script.
If you’re after some new games for your Switch 2, you’re in luck, as Ninja…
A Pokémon fan has been able to fund his own wedding, after rediscovering a trio…
The DJI Mini 4K is an excellent quadcopter drone camera for beginners looking to try…
long-press.js is a small JavaScript library which detects and handles the long press/tap event on…
Tension: We perform listening instead of practicing presence, creating distance while appearing close. Noise: The…
Tension: The command-and-control leadership that built successful companies in 2010 now creates anxious, depleted teams.…
This website uses cookies.