src/utils/ViewUtils.js
function addScrollerShadow(displayElement, scrollElement, showBottom) {
        // use fixed positioning when the display and scroll elements are the same
        var isPositionFixed = false;

        if (!scrollElement) {
            scrollElement = displayElement;
            isPositionFixed = true;
        }

        // update shadows when the scrolling element is scrolled
        var $displayElement = $(displayElement),
            $scrollElement = $(scrollElement);

        var $shadowTop = getOrCreateShadow($displayElement, "top", isPositionFixed);
        var $shadowBottom = (showBottom) ? getOrCreateShadow($displayElement, "bottom", isPositionFixed) : null;

        var doUpdate = function () {
            _updateScrollerShadow($displayElement, $scrollElement, $shadowTop, $shadowBottom, isPositionFixed);
        };

        // remove any previously installed listeners on this node
        $scrollElement.off("scroll.scroller-shadow");
        $displayElement.off("contentChanged.scroller-shadow");

        // add new ones
        $scrollElement.on("scroll.scroller-shadow", doUpdate);
        $displayElement.on("contentChanged.scroller-shadow", doUpdate);

        // update immediately
        doUpdate();
    }
function addScrollerShadow(displayElement, scrollElement, showBottom) {
        // use fixed positioning when the display and scroll elements are the same
        var isPositionFixed = false;

        if (!scrollElement) {
            scrollElement = displayElement;
            isPositionFixed = true;
        }

        // update shadows when the scrolling element is scrolled
        var $displayElement = $(displayElement),
            $scrollElement = $(scrollElement);

        var $shadowTop = getOrCreateShadow($displayElement, "top", isPositionFixed);
        var $shadowBottom = (showBottom) ? getOrCreateShadow($displayElement, "bottom", isPositionFixed) : null;

        var doUpdate = function () {
            _updateScrollerShadow($displayElement, $scrollElement, $shadowTop, $shadowBottom, isPositionFixed);
        };

        // remove any previously installed listeners on this node
        $scrollElement.off("scroll.scroller-shadow");
        $displayElement.off("contentChanged.scroller-shadow");

        // add new ones
        $scrollElement.on("scroll.scroller-shadow", doUpdate);
        $displayElement.on("contentChanged.scroller-shadow", doUpdate);

        // update immediately
        doUpdate();
    }
function addScrollerShadow ( displayElement , scrollElement , showBottom ) { // use fixed positioning when the display and scroll elements are the same var isPositionFixed = false ; if ( ! scrollElement ) { scrollElement = displayElement ; isPositionFixed = true ; } // update shadows when the scrolling element is scrolled var $displayElement = $ ( displayElement ) , $scrollElement = $ ( scrollElement ) ; var $shadowTop = getOrCreateShadow ( $displayElement , "top" , isPositionFixed ) ; var $shadowBottom = ( showBottom ) ? getOrCreateShadow ( $displayElement , "bottom" , isPositionFixed ) : null ; var doUpdate = function ( ) { _updateScrollerShadow ( $displayElement , $scrollElement , $shadowTop , $shadowBottom , isPositionFixed ) ; } ; // remove any previously installed listeners on this node $scrollElement . off ( "scroll.scroller-shadow" ) ; $displayElement . off ( "contentChanged.scroller-shadow" ) ; // add new ones $scrollElement . on ( "scroll.scroller-shadow" , doUpdate ) ; $displayElement . on ( "contentChanged.scroller-shadow" , doUpdate ) ; // update immediately doUpdate ( ) ; }
Installs event handlers for updatng shadow background elements to indicate vertical scrolling.
@param {!DOMElement} displayElement the DOMElement that displays the shadow. Must fire
"contentChanged" events when the element is resized or repositioned.
@param {?Object} scrollElement the object that is scrolled. Must fire "scroll" events
when the element is scrolled. If null, the displayElement is used.
@param {?boolean} showBottom optionally show the bottom shadow
Installs event handlers for updatng shadow background elements to indicate vertical scrolling .