jquery-scrolltofixed.js
function resetScroll() {
            // Set the element to it original positioning.
            target.trigger('preUnfixed.ScrollToFixed');
            setUnfixed();
            target.trigger('unfixed.ScrollToFixed');

            // Reset the last offset used to determine if the page has moved
            // horizontally.
            lastOffsetLeft = -1;

            // Capture the offset top of the target element.
            offsetTop = target.offset().top;

            // Capture the offset left of the target element.
            offsetLeft = target.offset().left;

            // If the offsets option is on, alter the left offset.
            if (base.options.offsets) {
                offsetLeft += (target.offset().left - target.position().left);
            }

            if (originalOffsetLeft == -1) {
                originalOffsetLeft = offsetLeft;
            }

            position = target.css('position');

            // Set that this has been called at least once.
            isReset = true;

            if (base.options.bottom != -1) {
                target.trigger('preFixed.ScrollToFixed');
                setFixed();
                target.trigger('fixed.ScrollToFixed');
            }
        }
function resetScroll() {
            // Set the element to it original positioning.
            target.trigger('preUnfixed.ScrollToFixed');
            setUnfixed();
            target.trigger('unfixed.ScrollToFixed');

            // Reset the last offset used to determine if the page has moved
            // horizontally.
            lastOffsetLeft = -1;

            // Capture the offset top of the target element.
            offsetTop = target.offset().top;

            // Capture the offset left of the target element.
            offsetLeft = target.offset().left;

            // If the offsets option is on, alter the left offset.
            if (base.options.offsets) {
                offsetLeft += (target.offset().left - target.position().left);
            }

            if (originalOffsetLeft == -1) {
                originalOffsetLeft = offsetLeft;
            }

            position = target.css('position');

            // Set that this has been called at least once.
            isReset = true;

            if (base.options.bottom != -1) {
                target.trigger('preFixed.ScrollToFixed');
                setFixed();
                target.trigger('fixed.ScrollToFixed');
            }
        }
function resetScroll ( ) { // Set the element to it original positioning. target . trigger ( 'preUnfixed.ScrollToFixed' ) ; setUnfixed ( ) ; target . trigger ( 'unfixed.ScrollToFixed' ) ; // Reset the last offset used to determine if the page has moved // horizontally. lastOffsetLeft = - 1 ; // Capture the offset top of the target element. offsetTop = target . offset ( ) . top ; // Capture the offset left of the target element. offsetLeft = target . offset ( ) . left ; // If the offsets option is on, alter the left offset. if ( base . options . offsets ) { offsetLeft += ( target . offset ( ) . left - target . position ( ) . left ) ; } if ( originalOffsetLeft == - 1 ) { originalOffsetLeft = offsetLeft ; } position = target . css ( 'position' ) ; // Set that this has been called at least once. isReset = true ; if ( base . options . bottom != - 1 ) { target . trigger ( 'preFixed.ScrollToFixed' ) ; setFixed ( ) ; target . trigger ( 'fixed.ScrollToFixed' ) ; } }
Capture the original offsets for the target element. This needs to be called whenever the page size changes or when the page is first scrolled. For some reason, calling this before the page is first scrolled causes the element to become fixed too late.
Capture the original offsets for the target element . This needs to be called whenever the page size changes or when the page is first scrolled . For some reason calling this before the page is first scrolled causes the element to become fixed too late .