jquery-scrolltofixed.js
function setFixed() {
            // Only fix the target element and the spacer if we need to.
            if (!isFixed()) {
                //get REAL dimensions (decimal fix)
                //Ref. http://stackoverflow.com/questions/3603065/how-to-make-jquery-to-not-round-value-returned-by-width
                var dimensions = target[0].getBoundingClientRect();

                // Set the spacer to fill the height and width of the target
                // element, then display it.
                spacer.css({
                    'display' : target.css('display'),
                    'width' : dimensions.width,
                    'height' : dimensions.height,
                    'float' : target.css('float')
                });

                // Set the target element to fixed and set its width so it does
                // not fill the rest of the page horizontally. Also, set its top
                // to the margin top specified in the options.

                cssOptions={
                    'z-index' : base.options.zIndex,
                    'position' : 'fixed',
                    'top' : base.options.bottom == -1?getMarginTop():'',
                    'bottom' : base.options.bottom == -1?'':base.options.bottom,
                    'margin-left' : '0px'
                }
                if (!base.options.dontSetWidth){ cssOptions['width']=target.css('width'); };

                target.css(cssOptions);

                target.addClass(base.options.baseClassName);

                if (base.options.className) {
                    target.addClass(base.options.className);
                }

                position = 'fixed';
            }
        }
function setFixed() {
            // Only fix the target element and the spacer if we need to.
            if (!isFixed()) {
                //get REAL dimensions (decimal fix)
                //Ref. http://stackoverflow.com/questions/3603065/how-to-make-jquery-to-not-round-value-returned-by-width
                var dimensions = target[0].getBoundingClientRect();

                // Set the spacer to fill the height and width of the target
                // element, then display it.
                spacer.css({
                    'display' : target.css('display'),
                    'width' : dimensions.width,
                    'height' : dimensions.height,
                    'float' : target.css('float')
                });

                // Set the target element to fixed and set its width so it does
                // not fill the rest of the page horizontally. Also, set its top
                // to the margin top specified in the options.

                cssOptions={
                    'z-index' : base.options.zIndex,
                    'position' : 'fixed',
                    'top' : base.options.bottom == -1?getMarginTop():'',
                    'bottom' : base.options.bottom == -1?'':base.options.bottom,
                    'margin-left' : '0px'
                }
                if (!base.options.dontSetWidth){ cssOptions['width']=target.css('width'); };

                target.css(cssOptions);

                target.addClass(base.options.baseClassName);

                if (base.options.className) {
                    target.addClass(base.options.className);
                }

                position = 'fixed';
            }
        }
function setFixed ( ) { // Only fix the target element and the spacer if we need to. if ( ! isFixed ( ) ) { //get REAL dimensions (decimal fix) //Ref. http://stackoverflow.com/questions/3603065/how-to-make-jquery-to-not-round-value-returned-by-width var dimensions = target [ 0 ] . getBoundingClientRect ( ) ; // Set the spacer to fill the height and width of the target // element, then display it. spacer . css ( { 'display' : target . css ( 'display' ) , 'width' : dimensions . width , 'height' : dimensions . height , 'float' : target . css ( 'float' ) } ) ; // Set the target element to fixed and set its width so it does // not fill the rest of the page horizontally. Also, set its top // to the margin top specified in the options. cssOptions = { 'z-index' : base . options . zIndex , 'position' : 'fixed' , 'top' : base . options . bottom == - 1 ? getMarginTop ( ) : '' , 'bottom' : base . options . bottom == - 1 ? '' : base . options . bottom , 'margin-left' : '0px' } if ( ! base . options . dontSetWidth ) { cssOptions [ 'width' ] = target . css ( 'width' ) ; } ; target . css ( cssOptions ) ; target . addClass ( base . options . baseClassName ) ; if ( base . options . className ) { target . addClass ( base . options . className ) ; } position = 'fixed' ; } }
Sets the target element to fixed. Also, sets the spacer to fill the void left by the target element.
Sets the target element to fixed . Also sets the spacer to fill the void left by the target element .