Skip to content

Commit

Permalink
added basic nested modal support
Browse files Browse the repository at this point in the history
  • Loading branch information
mpetty committed Sep 26, 2018
1 parent 34e1193 commit 4428dd2
Show file tree
Hide file tree
Showing 8 changed files with 158 additions and 114 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# Modal v1.17.0
# Modal v1.17.1

Library for opening content in a modal window. Built to be used with web applications and ajax.

- Requires jQuery 1.7+

### new in 1.17.1

Added support for nested modals. Modal windows will get appended after the last. when nested modals are closed, the previous modal will be displayed until the last one is closed which will destroy the modal elements.

### new in 1.17.0

Added module support
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "modal",

"version": "1.17.0",
"version": "1.17.1",

"license": "MIT",

Expand Down
31 changes: 26 additions & 5 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,24 @@
<script type='text/javascript' src='../dist/jquery.modal.min.js'></script>
<script>
$(function() {
// $('[data-toggle="modal2"]').modal2({
// centered: true,
// html: $('#modal-content').html()
// });

$.modal2({
centered: true,
html : $('#modal-content').html()
});
$('[data-toggle="modal2"]').modal2({
centered: true,
html: $('#modal-content').html()

$(document).on('click', '[data-toggle="modal2"]', function(e) {
var html = $($(this).attr('href')).html();

e.preventDefault();

$.modal2({
html: html
});
});
});
</script>
Expand All @@ -34,7 +45,7 @@ <h1>Header</h1>
<div class="modal-body">
<h1>HTML Ipsum Presents</h1>

<p><strong>Pellentesque habitant morbi tristique</strong> senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. <em>Aenean ultricies mi vitae est.</em> Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, <code>commodo vitae</code>, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. <a href="#">Donec non enim</a> in turpis pulvinar facilisis. Ut felis.</p>
<p><strong>Pellentesque habitant morbi tristique</strong> senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. <em>Aenean ultricies mi vitae est.</em> Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, <code>commodo vitae</code>, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. <a data-toggle="modal2" href="#modal-content-nested">Donec non enim</a> in turpis pulvinar facilisis. Ut felis.</p>

<h2>Header Level 2</h2>

Expand Down Expand Up @@ -62,8 +73,18 @@ <h3>Header Level 3</h3>
</div>
</div>

<div id="modal-content-nested" style="display: none;">
<div class="modal-header">
<h1>Nested Content</h1>
<span class="close" data-dismiss="modal2">x</span>
</div>
<div class="modal-body">
<p>Showing how nested modals work</p>
</div>
</div>

<div id="fragment">
<h1><a href="#" data-toggle="modal2" data-target="#modal-content">Open Modal</a></h1>
<h1><a href="#modal-content" data-toggle="modal2" data-target="#modal-content">Open Modal</a></h1>
</div>

</div>
Expand Down
2 changes: 1 addition & 1 deletion dist/jquery.modal.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/modal.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "modal",
"version": "1.17.0",
"version": "1.17.1",
"main": "src/jquery.modal.js",
"repository": {
"type": "git",
Expand Down
Loading

0 comments on commit 4428dd2

Please sign in to comment.