rice-framework/krad-web/src/main/webapp/krad/scripts/krad.utility.js
/**
 * Handles the calculation and positioning of sticky header elements on the screen when the user scrolls.  This
 * function should be called on a scroll event.
 */
Handles the calculation and positioning of sticky header elements on the screen when the user scrolls.  This
function should be called on a scroll event.
Handles the calculation and positioning of sticky header elements on the screen when the user scrolls . This function should be called on a scroll event .
function handleStickyContent() {
    if (stickyContent == undefined || stickyContent.length == 0) {
        return;
    }
    if (jQuery(window).scrollTop() >= Math.floor(stickyContentOffset.top)) {
        var topOffset = 0;
        var navAdjust = 0;
        stickyContent.each(function () {
            var height = jQuery(this).outerHeight();
            var thisOffset = jQuery(this).data("offset");
            var thisOffsetTop = Math.floor(thisOffset.top);
            if (thisOffset && thisOffsetTop - jQuery(window).scrollTop() > topOffset) {
                var diff = thisOffsetTop - jQuery(window).scrollTop();
                jQuery(this).attr("style", "position:fixed; left: 0; top: " + diff + "px;");
                navAdjust = diff + height;
            }
            else {
                jQuery(this).attr("style", "position:fixed; left: 0; top: " + topOffset + "px;");
                navAdjust = topOffset + height;
            }
            topOffset = topOffset + height;
        });
        var nav = jQuery("#" + kradVariables.NAVIGATION_ID);
        if (nav.length && nav.has(".nav-tabs").length === 0) {
            nav.attr("style", "position:absolute;");
        }
        currentHeaderHeight = navAdjust;
    }
    else if (jQuery(window).scrollTop() < Math.floor(stickyContentOffset.top)) {
        initStickyContent(jQuery(window).scrollTop());
    }
}
function handleStickyContent ( ) { if ( stickyContent == undefined || stickyContent . length == 0 ) { return ; } if ( jQuery ( window ) . scrollTop ( ) >= Math . floor ( stickyContentOffset . top ) ) { var topOffset = 0 ; var navAdjust = 0 ; stickyContent . each ( function ( ) { var height = jQuery ( this ) . outerHeight ( ) ; var thisOffset = jQuery ( this ) . data ( "offset" ) ; var thisOffsetTop = Math . floor ( thisOffset . top ) ; if ( thisOffset && thisOffsetTop - jQuery ( window ) . scrollTop ( ) > topOffset ) { var diff = thisOffsetTop - jQuery ( window ) . scrollTop ( ) ; jQuery ( this ) . attr ( "style" , "position:fixed; left: 0; top: " + diff + "px;" ) ; navAdjust = diff + height ; } else { jQuery ( this ) . attr ( "style" , "position:fixed; left: 0; top: " + topOffset + "px;" ) ; navAdjust = topOffset + height ; } topOffset = topOffset + height ; } ) ; var nav = jQuery ( "#" + kradVariables . NAVIGATION_ID ) ; if ( nav . length && nav . has ( ".nav-tabs" ) . length === 0 ) { nav . attr ( "style" , "position:absolute;" ) ; } currentHeaderHeight = navAdjust ; } else if ( jQuery ( window ) . scrollTop ( ) < Math . floor ( stickyContentOffset . top ) ) { initStickyContent ( jQuery ( window ) . scrollTop ( ) ) ; } }
Handles the calculation and positioning of sticky header elements on the screen when the user scrolls.
Handles the calculation and positioning of sticky header elements on the screen when the user scrolls .
//early return if no sticky content
 //adjust each sticky header piece based on whether their exists content between it or not
 //content exist between this sticky and last sticky
 //sticky content is adjacent to each other
 //adjust the fixed nav position (if navigation exists)
 // TODO support both absolute and fixed
 /* jQuery("#" + kradVariables.NAVIGATION_ID).attr("style", "position:fixed; top: " +
         (navAdjust) + "px;");*/ //the content is back to past the first sticky element (topmost)
