diff options
Diffstat (limited to 'ui/jquery.ui.position.js')
-rw-r--r-- | ui/jquery.ui.position.js | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/ui/jquery.ui.position.js b/ui/jquery.ui.position.js index 9e7407d7b..31da2237b 100644 --- a/ui/jquery.ui.position.js +++ b/ui/jquery.ui.position.js @@ -16,10 +16,14 @@ var rhorizontal = /left|center|right/, roffset = /[\+\-]\d+%?/, rposition = /^\w+/, rpercent = /%$/, - _position = $.fn.position; + _position = $.fn.position, + cachedScrollbarWidth; $.position = { scrollbarWidth: function() { + if ( cachedScrollbarWidth !== undefined ) { + return cachedScrollbarWidth; + } var w1, w2, div = $( "<div style='display:block;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>" ), innerDiv = div.children()[0]; @@ -36,7 +40,7 @@ $.position = { div.remove(); - return w1 - w2; + return (cachedScrollbarWidth = w1 - w2); }, getScrollInfo: function( within ) { var overflowX = within.isWindow ? "" : within.element.css( "overflow-x" ), |