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) {