Detect scrollbar width for browser that do not support scrollbar styling.

Fixes #800
This commit is contained in:
j 2012-06-28 12:18:33 +02:00
parent 55e2174831
commit 1118938e30

View file

@ -400,7 +400,25 @@ Ox.load.UI = function(options, callback) {
//@ Ox.UI.PATH <str> Path of Ox.UI
Ox.UI.PATH = Ox.PATH + 'Ox.UI/';
//@ Ox.UI.SCOLLBAR_SIZE <str> size of scrollbar
Ox.UI.SCROLLBAR_SIZE = $.browser.mozilla ? 16 : 12;
Ox.UI.SCROLLBAR_SIZE = $.browser.webkit ? 12 : (function() {
var inner = $('<p>').css({
height: '200px',
width: '100%'
}),
outer = $('<div>').css({
height: '150px',
left: 0,
overflow: 'hidden',
position: 'absolute',
top: 0,
visibility: 'hidden',
width: '200px'
}).append(inner).appendTo($('body')),
width;
width = inner[0].offsetWidth;
outer.css({overflow: 'scroll'});
return 1 + width - (inner[0].offsetWidth == width ? outer[0].clientWidth : inner[0].offsetWidth);
})();
//@ Ox.UI.getBarSize <s> get bar size by name
// fixme: the follwing should be deprecated
Ox.UI.getBarSize = function(size) {