This time I will share jQuery Plugin and tutorial about Cookie-controlled Fullscreen Modal – jQuery Simple Overlay, hope it will help you in programming stack.
The Simple Overlay jQuery plugin helps you create a user-friendly fullscreen modal popup that uses cookies to remember the close.
It means that the modal popup won’t redisplay until the cookie expires or is cleared from the browser.
More Features:
- Custom background image of the overlay.
- Custom modal content. HTML content is supported as well.
- Dark & Light themes.
- Allows you to reset the overlay state.
- Custom cookie settings.
- Allows you to open/close the overlay manually.
How to use it:
1. Include jQuery library, simple-overlay.min.css
, and simple-overlay.min.js
on the web page.
1 |
< link href = "/path/to/css/simple-overlay.css" rel = "stylesheet" /> |
2 |
< script src = "/path/to/cdn/jquery.min.js" ></ script > |
3 |
< script src = "/path/to/js/simple-overlay.js" ></ script > |
2. Create a modal popup and define your content in the content
option:
1 |
$( 'body' ).simpleOverlay({ |
3. Or load content from an inline element as follows:
1 |
< div id = "simple-overlay" class = "simple-overlay background-image" > |
2 |
< div class = "simple-container" >Modal Content Here</ div > |
3 |
< button type = "button" class = "close" aria-label = "Close" > |
4 |
< span aria-hidden = "true" >×</ span > |
1 |
$( 'body' ).simpleOverlay({ |
4. Determine the popup expiry time. Default: 30 days.
1 |
$( 'body' ).simpleOverlay({ |
3 |
name: 'simple-overlay' , |
5. Determine the popup expiry time. Default: 30 days.
1 |
$( 'body' ).simpleOverlay({ |
3 |
name: 'simple-overlay' , |
6. Switch to the Light theme.
1 |
$( 'body' ).simpleOverlay({ |
7. Reset the overlay state by increasing the revision. Default: 0.
1 |
$( 'body' ).simpleOverlay({ |
8. Add a background image to the overlay.
1 |
$( 'body' ).simpleOverlay({ |
9. More configuration options.
01 |
$( 'body' ).simpleOverlay({ |
13 |
containerId: 'simple-overlay' , |
16 |
contentContainerClass: 'simple-container' , |
19 |
hideClass: 'simple-hide' , |
10. Callback functions.
01 |
$( 'body' ).simpleOverlay({ |
04 |
triggerCustom: function () {}, |
07 |
beforeAttachContainer: function () {}, |
10 |
beforeOverlayOpen: function () {}, |
13 |
beforeOverlayClose: function () {}, |
16 |
beforeSetCookie: function () {}, |
19 |
beforeGetCookie: function () {}, |
22 |
afterAttachContainer: function () {}, |
25 |
afterOverlayOpen: function () {}, |
28 |
afterOverlayClose: function () {}, |
31 |
afterSetCookie: function () {}, |
34 |
afterGetCookie: function () {}, |
Changelog:
v1.0.3 (05/06/2020)
- Added Close On ESC parameter
This awesome jQuery plugin is developed by thexmanxyz. For more Advanced Usages, please check the demo page or visit the official website.