src/utils/ViewUtils.js
function _updateScrollerShadow($displayElement, $scrollElement, $shadowTop, $shadowBottom, isPositionFixed) {
        var offsetTop           = 0,
            scrollElement       = $scrollElement.get(0),
            scrollTop           = scrollElement.scrollTop,
            topShadowOffset     = Math.min(scrollTop - SCROLL_SHADOW_HEIGHT, 0),
            displayElementWidth = $displayElement.width();

        if ($shadowTop) {
            $shadowTop.css("background-position", "0px " + topShadowOffset + "px");

            if (isPositionFixed) {
                offsetTop = $displayElement.offset().top;
                $shadowTop.css("top", offsetTop);
            }

            if (isPositionFixed) {
                $shadowTop.css("width", displayElementWidth);
            }
        }

        if ($shadowBottom) {
            var clientHeight        = scrollElement.clientHeight,
                outerHeight         = $displayElement.outerHeight(),
                scrollHeight        = scrollElement.scrollHeight,
                bottomShadowOffset  = SCROLL_SHADOW_HEIGHT; // outside of shadow div viewport

            if (scrollHeight > clientHeight) {
                bottomShadowOffset -= Math.min(SCROLL_SHADOW_HEIGHT, (scrollHeight - (scrollTop + clientHeight)));
            }

            $shadowBottom.css("background-position", "0px " + bottomShadowOffset + "px");
            $shadowBottom.css("top", offsetTop + outerHeight - SCROLL_SHADOW_HEIGHT);
            $shadowBottom.css("width", displayElementWidth);
        }
    }
function _updateScrollerShadow($displayElement, $scrollElement, $shadowTop, $shadowBottom, isPositionFixed) {
        var offsetTop           = 0,
            scrollElement       = $scrollElement.get(0),
            scrollTop           = scrollElement.scrollTop,
            topShadowOffset     = Math.min(scrollTop - SCROLL_SHADOW_HEIGHT, 0),
            displayElementWidth = $displayElement.width();

        if ($shadowTop) {
            $shadowTop.css("background-position", "0px " + topShadowOffset + "px");

            if (isPositionFixed) {
                offsetTop = $displayElement.offset().top;
                $shadowTop.css("top", offsetTop);
            }

            if (isPositionFixed) {
                $shadowTop.css("width", displayElementWidth);
            }
        }

        if ($shadowBottom) {
            var clientHeight        = scrollElement.clientHeight,
                outerHeight         = $displayElement.outerHeight(),
                scrollHeight        = scrollElement.scrollHeight,
                bottomShadowOffset  = SCROLL_SHADOW_HEIGHT; // outside of shadow div viewport

            if (scrollHeight > clientHeight) {
                bottomShadowOffset -= Math.min(SCROLL_SHADOW_HEIGHT, (scrollHeight - (scrollTop + clientHeight)));
            }

            $shadowBottom.css("background-position", "0px " + bottomShadowOffset + "px");
            $shadowBottom.css("top", offsetTop + outerHeight - SCROLL_SHADOW_HEIGHT);
            $shadowBottom.css("width", displayElementWidth);
        }
    }
function _updateScrollerShadow ( $displayElement , $scrollElement , $shadowTop , $shadowBottom , isPositionFixed ) { var offsetTop = 0 , scrollElement = $scrollElement . get ( 0 ) , scrollTop = scrollElement . scrollTop , topShadowOffset = Math . min ( scrollTop - SCROLL_SHADOW_HEIGHT , 0 ) , displayElementWidth = $displayElement . width ( ) ; if ( $shadowTop ) { $shadowTop . css ( "background-position" , "0px " + topShadowOffset + "px" ) ; if ( isPositionFixed ) { offsetTop = $displayElement . offset ( ) . top ; $shadowTop . css ( "top" , offsetTop ) ; } if ( isPositionFixed ) { $shadowTop . css ( "width" , displayElementWidth ) ; } } if ( $shadowBottom ) { var clientHeight = scrollElement . clientHeight , outerHeight = $displayElement . outerHeight ( ) , scrollHeight = scrollElement . scrollHeight , bottomShadowOffset = SCROLL_SHADOW_HEIGHT ; // outside of shadow div viewport if ( scrollHeight > clientHeight ) { bottomShadowOffset -= Math . min ( SCROLL_SHADOW_HEIGHT , ( scrollHeight - ( scrollTop + clientHeight ) ) ) ; } $shadowBottom . css ( "background-position" , "0px " + bottomShadowOffset + "px" ) ; $shadowBottom . css ( "top" , offsetTop + outerHeight - SCROLL_SHADOW_HEIGHT ) ; $shadowBottom . css ( "width" , displayElementWidth ) ; } }
Positions shadow background elements to indicate vertical scrolling.
@param {!DOMElement} $displayElement the DOMElement that displays the shadow
@param {!Object} $scrollElement the object that is scrolled
@param {!DOMElement} $shadowTop div .scroller-shadow.top
@param {!DOMElement} $shadowBottom div .scroller-shadow.bottom
@param {boolean} isPositionFixed When using absolute position, top remains at 0.
Positions shadow background elements to indicate vertical scrolling .