%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/kfvehpdt/epouse-et-moi.com/js/hydra/
Upload File :
Create Path :
Current File : /home/kfvehpdt/epouse-et-moi.com/js/hydra/DynResize.jquery.js

/***************************************
* DYNRESIZE                            *
* Version: 1.0.1                       *
* Authors: Corey Vixie                 *
*          Thomas Clowes               *
* License: WTFPL v2.0                  *
*          http://www.wtfpl.net/about/ *
***************************************/

(function( $ ) {

    var dynVar = {};

    $.fn.hasScrollBar = function() {

        var current      = $(this)[0],
            hasScrollBar = false,
            inH          = $(this).innerHeight(),
            scH          = current.scrollHeight,
            inW          = $(this).innerWidth(),
            scW          = current.scrollWidth;

        if (( inH < scH && dynVar.lastHeight != scH ) || ( inW < scW && dynVar.lastWidth != scW )) {
            hasScrollBar = true;
        }
        
        return hasScrollBar;

        dynVar.lastWidth  = scW;
        dynVar.lastHeight = scH;
    };

    $.fn.dynResize = function( options ) {

        var options = $.extend({
            maxSize: 22,
            minSize: 5,
            unit: 'px'
        },options);

        return this.each(function(){
            var that = $(this),
                size = parseInt(that.css('font-size'));

            that.css({ 'white-space' : 'pre' });

            if (that.hasScrollBar()){
                while( that.hasScrollBar() && size > options.minSize ) {
                    size-=1;
                    that.css({ 'font-size':size+options.unit });
                }
                return;
            }
            else {
                while( !that.hasScrollBar() && size <= options.maxSize ) {
                    size+=1;
                    that.css({ 'font-size' : size+options.unit });
                }
                return;
            }
        });
    };
})(jQuery);

Zerion Mini Shell 1.0