]> source.dussan.org Git - jquery-ui.git/commitdiff
Resizable: Fixed containment within relative/absolute positioned parent. Fixes ...
authorScott González <scott.gonzalez@gmail.com>
Thu, 19 Feb 2009 02:49:54 +0000 (02:49 +0000)
committerScott González <scott.gonzalez@gmail.com>
Thu, 19 Feb 2009 02:49:54 +0000 (02:49 +0000)
ui/ui.resizable.js

index bfa04ede2f4c4d88a62a73c89eecaf832b875c4e..114aab83003c6ca8b2f136478786ea1f14e468fd 100644 (file)
@@ -690,6 +690,11 @@ $.ui.plugin.add("resizable", "containment", {
                var woset = Math.abs( (self._helper ? self.offset.left - cop.left : (self.offset.left - cop.left)) + self.sizeDiff.width ),
                                        hoset = Math.abs( (self._helper ? self.offset.top - cop.top : (self.offset.top - co.top)) + self.sizeDiff.height );
 
+               var isParent = self.containerElement.get(0) == self.element.parent().get(0),
+                   isOffsetRelative = /relative|absolute/.test(self.containerElement.css('position'));
+
+               if(isParent && isOffsetRelative) woset -= self.parentData.left;
+
                if (woset + self.size.width >= self.parentData.width) {
                        self.size.width = self.parentData.width - woset;
                        if (pRatio) self.size.height = self.size.width / o.aspectRatio;