Hi,

i recently was in need of the exaxt Pixelsize of the client's
scrollbars. After searching up and down the web i came up with the
following function (its not something special) - which has been
inspired by several sources:

                        getScrollbarSize: function()
                        {
                                var db = document.body;
                                var prevOverflow = db.getStyle('overflow');
                                db.setStyle('overflow','hidden');
                                var w = db.clientWidth;
                                var h = db.clientHeight;
                                db.setStyle('overflow','scroll');
                                var S1 = {
                                        'width' : w -= db.clientWidth,
                                        'height' : h -= db.clientHeight
                                };
                                if(!S1.width) S1.width = db.offsetWidth - 
db.clientWidth;
                                if(!S1.height) S1.height = db.offsetHeight - 
db.clientHeight;
                                db.setStyle('overflow',prevOverflow);
                                return S1;
                        }

Is there any mootools internal function i overlooked or is there any
better crossbrowser way of doing the calculations? I saw jQuery is
using textarea stuff and browser dependant divs .. i tried their code
(converted to moo / native JS) but was never realy working (only in
mozilla).

Any Feedback appreciated

Thanx

Reply via email to