0

以下の fittext.js 関数をトリガーするにはどうすればよいですか

$.fn.fitText = function( kompressor, options ) {
    var compressor = kompressor || 1,
            settings = $.extend({
              'minFontSize' : Number.NEGATIVE_INFINITY,
              'maxFontSize' : Number.POSITIVE_INFINITY
            }, options);

        return this.each(function(){

          // Store the object
          var $this = $(this);

          // Resizer() resizes items based on the object width divided by the compressor * 10
          var resizer = function () {
            $this.css('font-size', Math.max(Math.min($this.width() / (compressor*10), parseFloat(settings.maxFontSize)), parseFloat(settings.minFontSize)));
          };
    )};

change() メソッドを使用していますか?

$('#drop').change(function(){
     $('#tf').css('width', $(this).val());
     //resizer(); // does not work
     //$('#tf').fitText(1.2, { minFontSize: '20px', maxFontSize: '40px' });// does not work
});
4

1 に答える 1