Commit 88f06594 authored by Michal Čihař's avatar Michal Čihař

Javascript cleanup in autogrow plugin

parent 4e15b11b
...@@ -3,13 +3,12 @@ ...@@ -3,13 +3,12 @@
/* /*
* Auto-growing textareas; technique ripped from Facebook * Auto-growing textareas; technique ripped from Facebook
*/ */
$.fn.autogrow = function(options) { $.fn.autogrow = function() {
this.filter('textarea').each(function() { this.filter('textarea').each(function() {
var $this = $(this), var $this = $(this),
minHeight = $this.height(), minHeight = $this.height();
lineHeight = $this.css('lineHeight');
var shadow = $('<div></div>').css({ var shadow = $('<div></div>').css({
position: 'absolute', position: 'absolute',
...@@ -31,7 +30,7 @@ ...@@ -31,7 +30,7 @@
shadow.html(val); shadow.html(val);
$this.css('height', Math.max(shadow.height() + 20, minHeight)); $this.css('height', Math.max(shadow.height() + 20, minHeight));
} };
$this.change(update).keyup(update).keydown(update); $this.change(update).keyup(update).keydown(update);
...@@ -41,6 +40,6 @@ ...@@ -41,6 +40,6 @@
return this; return this;
} };
})(jQuery); })(jQuery);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment