Mass framework scrollbar Module

Source: Internet
Author: User

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 $ ;});

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.