From d1608af35a78bfde20d39e8e5a1518a6b53711fa Mon Sep 17 00:00:00 2001 From: Jason Seney Date: Thu, 31 Mar 2011 16:15:21 -0400 Subject: [PATCH] Adding minimum left and top options for setting position --- src/jquery.simplemodal.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/jquery.simplemodal.js b/src/jquery.simplemodal.js index ac14a8f..190a302 100644 --- a/src/jquery.simplemodal.js +++ b/src/jquery.simplemodal.js @@ -178,6 +178,8 @@ minWidth: null, maxHeight: null, maxWidth: null, + minLeft: 0, + minTop: 0, autoResize: false, autoPosition: true, zIndex: 1000, @@ -582,6 +584,11 @@ top = hc; left = vc; } + + // Enforce minimum position (useful for keeping dialog within window boundries) + left = left < s.o.minLeft ? s.o.minLeft : left; + top = top < s.o.minTop ? s.o.minTop : top; + s.d.container.css({left: left, top: top}); }, watchTab: function (e) {