diff options
author | neilmonroe <neil.monroe@gmail.com> | 2009-03-20 13:56:33 -0700 |
---|---|---|
committer | neilmonroe <neil.monroe@gmail.com> | 2009-03-20 13:56:33 -0700 |
commit | 9d3b02d85e5e54b1be54330af8251ac6df972b54 (patch) | |
tree | 03a526161ce13b5da1de140cfe391425a23300cd /jquery.countable.js | |
parent | 8312a917dc56aa2688df1ab6e4835c73d1130b59 (diff) | |
download | jquery-countable-9d3b02d85e5e54b1be54330af8251ac6df972b54.zip jquery-countable-9d3b02d85e5e54b1be54330af8251ac6df972b54.tar.gz jquery-countable-9d3b02d85e5e54b1be54330af8251ac6df972b54.tar.bz2 |
Updated `appendMethod` options and added `target` option.
Diffstat (limited to 'jquery.countable.js')
-rw-r--r-- | jquery.countable.js | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/jquery.countable.js b/jquery.countable.js index fb0b569..1098642 100644 --- a/jquery.countable.js +++ b/jquery.countable.js @@ -10,10 +10,11 @@ $.fn.extend({ return this.each(function() { var $this = $(this), interval, prev_char_diff, $el; options = $.extend({ - threshold: 0.5, - appendMethod: 'insertAfter', // insertBefore || insertAfter + threshold: .5, + appendMethod: 'insertAfter', // insertBefore || insertAfter || prependTo || appendTo + target: $this, // element in which to place the counter startOpacity: .25, - maxLength: parseInt( $this.attr('maxlength'), 10 ), + maxLength: parseInt( $this.attr('maxlength'), 10 ) || 0, maxClassName: 'maxed', className: 'counter', tagName: 'span', @@ -27,7 +28,7 @@ $.fn.extend({ .html( options.positiveCopy.replace("{n}", '<span class="num"/>') ) .addClass( options.className ); if ( $.support.opacity ) $el.css({ opacity: 0 }); // don't set opacity for IE to avoid clear text issues. - $el[options.appendMethod]($this); + $el[options.appendMethod](options.target); $this .bind('keyup', check) |