textarea 高度自适应
2015-03-10 16:16
316 查看
jQuery.fn.extend({ autoHeight: function(){ return this.each(function(){ var $this = jQuery(this); if( !$this.attr('_initAdjustHeight') ){ $this.attr('_initAdjustHeight', $this.outerHeight()); } _adjustH(this).on('input', function(){ _adjustH(this); }); }); /** * 重置高度 * @param {Object} elem */ function _adjustH(elem){ var $obj = jQuery(elem); return $obj.css({height: $obj.attr('_initAdjustHeight'), 'overflow-y': 'hidden'}) .height( elem.scrollHeight ); } } }); // 使用 $(function(){ $('textarea').autoHeight(); });
相关文章推荐
- Textarea 高度自适应 根据内容自适应高度
- textarea高度自适应
- textarea 自适应内容高度
- div模拟textarea以css控制最大高度和最小高度实现高度自适应实例页面
- jquery实现textarea 高度自适应 转自http://www.jb51.net/article/61997.htm
- textarea标签自适应宽度和高度
- textarea如何实现高度自适应?
- jquery实现文本框textarea自适应高度
- textarea 自适应高度
- Jquery插件----TextArea高度自适应
- 结合jquery,使得textarea自适应高度,并且提示层跟随光标移动
- TEXTAREA高度自适应自动展开
- Jquery实现textarea根据文本内容自适应高度
- textarea自适应高度
- textarea显示全部内容支持高度自适应
- textarea 自适应高度
- 模拟新浪微博评论textarea输入框随着输入内容增多输入框高度自适应
- css textarea 高度自适应,无滚动条
- textarea 高度自适应
- React textarea自适应文字高度伸缩 超简单版