AJAX Modal Window Plugin jQuery - Download Lightweight AJAX Modal Window Plugin In jQuery

Download Lightweight AJAX Modal Window Plugin In jQuery

Posted on

This time I will share jQuery Plugin and tutorial about Lightweight AJAX Modal Window Plugin In jQuery, hope it will help you in programming stack.

AJAX Modal Window Plugin jQuery - Download Lightweight AJAX Modal Window Plugin In jQuery

File Size: 14.5 KB
Views Total: 1569
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

A minimal, clean, dynamic, responsive jQuery modal window plugin that loads remote or local html content using AJAX requests.

How to use it:

1. Load the script ‘modal-load-content.js’ after loading jQuery JavaScript library:

1 <script src="//code.jquery.com/jquery-3.2.1.min.js"></script>
2 <script src="modal-load-content.js"></script>

2. Add the following modal styles to your CSS file.

01 .modal-load-content-container {
02   background-color: #fff;
03   border: 0;
04   box-shadow: 2px 2px 7px rgba(15, 16, 21, 0.1);
05   display: none;
06   margin: 0;
07   overflow: hidden;
08   overflow-y: auto;
09   position: fixed;
10   width: 600px;
11   z-index: 101;
12 }
13  
14 .modal-load-content-container.opened { display: block; }
15  
16 .modal-load-content-container > * { padding: 20px; }
17  
18 .modal-load-content-overlay {
19   background-color: rgba(0, 0, 0, 0.4);
20   display: none;
21   height: 100%;
22   left: 0;
23   position: fixed;
24   top: 0;
25   width: 100%;
26   z-index: 100;
27 }
28  
29 .modal-load-content-overlay.opened { display: block; }

3. Initialize the plugin and we’re ready to go.

1 $('.call-to-action').modalLoadContent({
2   debugMode: true // default: false
3 });

4. Create a modal trigger link and specify the content to be loaded in the modal as this:

1 <a class="call-to-action" href="http://jquerscript.net">JQuery Script</a>

5. The trigger links could be any DOM elements such as buttons:

1 <button class="call-to-action"
2         data-href="http://jqueryscript.net">
3         jQuery Script
4 </button>

6. You can also load specific elements of the external page into the modal window.

1 <a class="call-to-action"
2    data-target=".your-selector"
3    href="http://jqueryscript.net">
4    jQuery Script
5 </a>

Change log:

2017-09-29

  • Fix JSHint warnings

2017-09-27

  • added close link to modal

This awesome jQuery plugin is developed by williankeller. For more Advanced Usages, please check the demo page or visit the official website.

source : jqueryscript.net