form-textarea.js 855 B

12345678910111213
  1. /*!
  2. * textarea autosize v0.4.0
  3. * https://github.com/javierjulio/textarea-autosize
  4. */
  5. !function(t,e){function i(e){this.element=e,this.$element=t(e),this.init()}var n="textareaAutoSize",h="plugin_"+n,s=function(t){return t.replace(/\s/g,"").length>0};i.prototype={init:function(){var i=(this.$element.outerHeight(),parseInt(this.$element.css("paddingBottom"))+parseInt(this.$element.css("paddingTop")));s(this.element.value)&&this.$element.height(this.element.scrollHeight-i),this.$element.on("input keyup",function(){var n=t(e),h=n.scrollTop();t(this).height(0).height(this.scrollHeight-i),n.scrollTop(h)})}},t.fn[n]=function(e){return this.each(function(){t.data(this,h)||t.data(this,h,new i(this,e))}),this}}(jQuery,window,document);
  6. // textarea autosize default
  7. $(function () {
  8. 'use strict';
  9. $('.textarea-autosize').textareaAutoSize();
  10. });