<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">(function($){

    /**
     * Copyright 2012, Digital Fusion
     * Licensed under the MIT license.
     * http://teamdf.com/jquery-plugins/license/
     *
     * @author Sam Sehnert
     * @desc A small plugin that checks whether elements are within
     *       the user visible viewport of a web browser.
     *       only accounts for vertical position, not horizontal.
     */
    var $w = $(window);
    $.fn.visible = function(partial,hidden,direction){

        if (this.length &lt; 1)
            return;

        var $t        = this.length &gt; 1 ? this.eq(0) : this,
            t         = $t.get(0),
            vpWidth   = $w.width(),
            vpHeight  = $w.height(),
            direction = (direction) ? direction : 'both',
            clientSize = hidden === true ? t.offsetWidth * t.offsetHeight : true;

        if (typeof t.getBoundingClientRect === 'function'){

            // Use this native browser method, if available.
            var rec = t.getBoundingClientRect(),
                tViz = rec.top    &gt;= 0 &amp;&amp; rec.top    &lt;  vpHeight,
                bViz = rec.bottom &gt;  0 &amp;&amp; rec.bottom &lt;= vpHeight,
                lViz = rec.left   &gt;= 0 &amp;&amp; rec.left   &lt;  vpWidth,
                rViz = rec.right  &gt;  0 &amp;&amp; rec.right  &lt;= vpWidth,
                vVisible   = partial ? tViz || bViz : tViz &amp;&amp; bViz,
                hVisible   = partial ? lViz || lViz : lViz &amp;&amp; rViz;

            if(direction === 'both')
                return clientSize &amp;&amp; vVisible &amp;&amp; hVisible;
            else if(direction === 'vertical')
                return clientSize &amp;&amp; vVisible;
            else if(direction === 'horizontal')
                return clientSize &amp;&amp; hVisible;
        } else {

            var viewTop         = $w.scrollTop(),
                viewBottom      = viewTop + vpHeight,
                viewLeft        = $w.scrollLeft(),
                viewRight       = viewLeft + vpWidth,
                offset          = $t.offset(),
                _top            = offset.top,
                _bottom         = _top + $t.height(),
                _left           = offset.left,
                _right          = _left + $t.width(),
                compareTop      = partial === true ? _bottom : _top,
                compareBottom   = partial === true ? _top : _bottom,
                compareLeft     = partial === true ? _right : _left,
                compareRight    = partial === true ? _left : _right;

            if(direction === 'both')
                return !!clientSize &amp;&amp; ((compareBottom &lt;= viewBottom) &amp;&amp; (compareTop &gt;= viewTop)) &amp;&amp; ((compareRight &lt;= viewRight) &amp;&amp; (compareLeft &gt;= viewLeft));
            else if(direction === 'vertical')
                return !!clientSize &amp;&amp; ((compareBottom &lt;= viewBottom) &amp;&amp; (compareTop &gt;= viewTop));
            else if(direction === 'horizontal')
                return !!clientSize &amp;&amp; ((compareRight &lt;= viewRight) &amp;&amp; (compareLeft &gt;= viewLeft));
        }
    };

})(jQuery);</pre></body></html>