Permalink
Browse files

Added maxWidth and maxHeight for sizes.

Sometimes there may be the need to limit the maximum size of a modal to be consistent in size/layout for the user.
  • Loading branch information...
1 parent 5a243fc commit d5d7a1657619dc8508b2943bc30e60420539cc6b @Blackskyliner Blackskyliner committed Feb 21, 2014
Showing with 5 additions and 3 deletions.
  1. +5 −3 js/jquery.nyroModal.js
@@ -99,6 +99,8 @@ jQuery(function($, undefined) {
h: undefined, // height
minW: undefined, // minimum Width
minH: undefined, // minimum height
+ maxW: undefined, // maximum width
+ maxH: undefined, // maximum height
wMargin: undefined, // Horizontal margin
hMargin: undefined // Vertical margin
},
@@ -183,8 +185,8 @@ jQuery(function($, undefined) {
// Update sizes element to not go outsize the viewport.
// Will call 'size' callback filter
size: function() {
- var maxHeight = this.getInternal().fullSize.viewH - this.sizes.hMargin,
- maxWidth = this.getInternal().fullSize.viewW - this.sizes.wMargin;
+ var maxHeight = (typeof this.sizes.maxH !== 'undefined') ? this.sizes.maxH : this.getInternal().fullSize.viewH - this.sizes.hMargin,
+ maxWidth = (typeof this.sizes.maxW !== 'undefined') ? this.sizes.maxW : this.getInternal().fullSize.viewW - this.sizes.wMargin;
if (this.sizes.minW && this.sizes.minW > this.sizes.w)
this.sizes.w = this.sizes.minW;
if (this.sizes.minH && this.sizes.minH > this.sizes.h)
@@ -944,4 +946,4 @@ function ucfirst(str) {
str += '';
var f = str.charAt(0).toUpperCase();
return f + str.substr(1);
-}
+}

0 comments on commit d5d7a16

Please sign in to comment.