diff options
author | Eduardo Lundgren <eduardolundgren@gmail.com> | 2009-01-28 21:48:51 +0000 |
---|---|---|
committer | Eduardo Lundgren <eduardolundgren@gmail.com> | 2009-01-28 21:48:51 +0000 |
commit | a853e4fd17c61bf74a87c30f75401ec6fb8879ec (patch) | |
tree | 8b9e6f84354365eca7201042dd7a705255032c84 /ui/ui.resizable.js | |
parent | 1ad50e24a9f13c99b6a04337e1f6729a5113092d (diff) | |
download | jquery-ui-a853e4fd17c61bf74a87c30f75401ec6fb8879ec.tar.gz jquery-ui-a853e4fd17c61bf74a87c30f75401ec6fb8879ec.zip |
Fixed #3954
Diffstat (limited to 'ui/ui.resizable.js')
-rw-r--r-- | ui/ui.resizable.js | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/ui/ui.resizable.js b/ui/ui.resizable.js index 60d966cc9..964762527 100644 --- a/ui/ui.resizable.js +++ b/ui/ui.resizable.js @@ -214,8 +214,7 @@ $.widget("ui.resizable", $.extend({}, $.ui.mouse, { _mouseStart: function(event) { - var o = this.options, iniPos = this.element.position(), el = this.element, - num = function(v) { return parseInt(v, 10) || 0; }; + var o = this.options, iniPos = this.element.position(), el = this.element; this.resizing = true; this.documentScroll = { top: $(document).scrollTop(), left: $(document).scrollLeft() }; @@ -299,7 +298,7 @@ $.widget("ui.resizable", $.extend({}, $.ui.mouse, { _mouseStop: function(event) { this.resizing = false; - var o = this.options, num = function(v) { return parseInt(v, 10) || 0; }, self = this; + var o = this.options, self = this; if(this._helper) { var pr = this.proportionallyResize, ista = pr.length && (/textarea/i).test(pr[0].nodeName), @@ -665,10 +664,13 @@ $.ui.plugin.add("resizable", "containment", { } // i'm a node, so compute top, left, right, bottom - else{ - self.containerOffset = $(ce).offset(); - self.containerPosition = $(ce).position(); - self.containerSize = { height: $(ce).innerHeight(), width: $(ce).innerWidth() }; + else { + var element = $(ce), p = []; + $([ "Top", "Right", "Left", "Bottom" ]).each(function(i, name) { p[i] = num(element.css("padding" + name)); }); + + self.containerOffset = element.offset(); + self.containerPosition = element.position(); + self.containerSize = { height: (element.innerHeight() - p[3]), width: (element.innerWidth() - p[1]) }; var co = self.containerOffset, ch = self.containerSize.height, cw = self.containerSize.width, width = ($.ui.hasScroll(ce, "left") ? ce.scrollWidth : cw ), height = ($.ui.hasScroll(ce) ? ce.scrollHeight : ch); @@ -786,4 +788,8 @@ $.ui.plugin.add("resizable", "grid", { }); +var num = function(v) { + return parseInt(v, 10) || 0; +}; + })(jQuery); |