dist/toolkit.js
function() {
        var win = $(window),
            options = this.options,
            element = this.element,
            parent = options.context ? element.parents(options.context) : element.parent();

        this.viewport = {
            width: win.width(),
            height: win.height()
        };

        this.elementHeight = element.outerHeight(true); // Include margin
        this.parentHeight = parent.height(); // Exclude padding
        this.parentTop = parent.offset().top;

        // Disable pin if element is larger than the viewport
        if (options.lock && this.elementHeight >= this.viewport.height) {
            this.active = false;

        // Enable pin if the parent is larger than the child
        } else {
            this.active = (element.is(':visible') && this.parentHeight > this.elementHeight);
        }
    }
function() {
        var win = $(window),
            options = this.options,
            element = this.element,
            parent = options.context ? element.parents(options.context) : element.parent();

        this.viewport = {
            width: win.width(),
            height: win.height()
        };

        this.elementHeight = element.outerHeight(true); // Include margin
        this.parentHeight = parent.height(); // Exclude padding
        this.parentTop = parent.offset().top;

        // Disable pin if element is larger than the viewport
        if (options.lock && this.elementHeight >= this.viewport.height) {
            this.active = false;

        // Enable pin if the parent is larger than the child
        } else {
            this.active = (element.is(':visible') && this.parentHeight > this.elementHeight);
        }
    }
function ( ) { var win = $ ( window ) , options = this . options , element = this . element , parent = options . context ? element . parents ( options . context ) : element . parent ( ) ; this . viewport = { width : win . width ( ) , height : win . height ( ) } ; this . elementHeight = element . outerHeight ( true ) ; // Include margin this . parentHeight = parent . height ( ) ; // Exclude padding this . parentTop = parent . offset ( ) . top ; // Disable pin if element is larger than the viewport if ( options . lock && this . elementHeight >= this . viewport . height ) { this . active = false ; // Enable pin if the parent is larger than the child } else { this . active = ( element . is ( ':visible' ) && this . parentHeight > this . elementHeight ) ; } }
Calculate the dimensions and offsets of the interacting elements.
Calculate the dimensions and offsets of the interacting elements .