This is a peripheral module, which provides a tool for processing the scroll bar.
Define ("scrollbar", ["CSS"], function ($) {function hasscrollbar (target, key) {// determine whether a horizontal or vertical scroll bar var val = target.css ('overflow-'+ key) if (val = 'scroll') return true; if (val = 'den den ') return false; If (val = 'auto') {var El = target [0], method = Key = 'y '? 'Height': 'width'; return El ['client' + method] <El ['scroll '+ method];} return false} $. FN. hasscrollbar = function () {// determines whether the first element of the current match has a scroll bar return isdisplayscrollbar (this, 'x') | isdisplayscrollbar (this, 'x ');} $. getdefascscrollbarwidth = function () {// obtain the default scroll bar width of the current window if ($. getdefascscrollbarwidth. RET) {return $. getdefascscrollbarwidth. RET} var test = $ ('<Div style = "width: 100px; heigh T: 100px; overflow: Scroll; position: absolute; top:-9999px; "/> '). appendto ("body"); var ret = test [0]. offsetwidth-test [0]. clientwidth; test. remove (); return $. getdefascscrollbarwidth. ret = ret;} $. getscrollbarwidth = function (node) {// get the message var target of the current element's scroll bar =$ (node), width = $. getdefascscrollbarwidth (); Return {X: hasscrollbar (target, 'x ')? Width: 0, Y: hasscrollbar (target, 'y ')? Width: 0 }}return $ ;});