Permalink
Browse files

Add nonStackable setting for nmObject

Add isStackable function for nmObject
Use this new setting to create the new nmObject for element binded in a modal
  • Loading branch information...
1 parent b4a65e2 commit a771d6237dc7c3a278f6aae59166ceb01c18caf8 @nyroDev committed Jun 13, 2011
Showing with 12 additions and 3 deletions.
  1. +12 −3 js/jquery.nyroModal.js
@@ -24,6 +24,7 @@ jQuery(function($, undefined) {
closeButton: '<a href="#" class="nyroModalClose nyroModalCloseButton nmReposition" title="close">Close</a>', // Close button HTML
stack: false, // Indicates if links automatically binded inside the modal should stack or not
+ nonStackable: 'form', // Filter to not stack DOM element
header: undefined, // header include in every modal
footer: undefined, // footer include in every modal
@@ -158,9 +159,9 @@ jQuery(function($, undefined) {
},
// Get the nmObject for a new nyroModal
- getForNewLinks: function() {
+ getForNewLinks: function(elt) {
var ret;
- if (this.stack) {
+ if (this.stack && (!elt || this.isStackable(elt))) {
ret = $.extend(true, {}, this);
ret._nmOpener = undefined;
ret.elts.all = undefined;
@@ -173,6 +174,11 @@ jQuery(function($, undefined) {
ret._open = false;
return ret;
},
+
+ // Indicate if an element can be stackable or not, regarding the nonStackable setting
+ isStackable: function(elt) {
+ return !elt.is(this.nonStackable);
+ },
// key handle function.
// Will call 'keyHandle' callback filter
@@ -800,7 +806,10 @@ jQuery(function($, undefined) {
},
beforeShowCont: function(nm) {
nm.elts.cont
- .find('.nyroModal').nyroModal(nm.getForNewLinks(), true).end()
+ .find('.nyroModal').each(function() {
+ var cur = $(this);
+ cur.nyroModal(nm.getForNewLinks(cur), true);
+ }).end()
.find('.nyroModalClose').bind('click.nyroModal', function(e) {
e.preventDefault();
nm.close();

0 comments on commit a771d62

Please sign in to comment.