使用autosize插件写出输入框换行的效果

由于输入框我想不到有什么方法能监听换行再赋值高度,所以我就用了这个插件弄了,还是挺香的~~先看图
使用后效果

// 输入框的样式
.animated {
	padding: .2rem .2rem 0 .2rem;
	border-radius: .1rem;
	background: #f5f5f5;
	vertical-align: top;
	flex: 1;
	max-height: 1.6rem;
	line-height: .36rem;
	resize: none;
}
<textarea class='animated' style="margin-bottom: .2rem" placeholder="请加入交流学习吧"></textarea>
<script src="../js/jquery.autosize.js"></script>
<script>
	$(function(){
		$('.animated').autosize();
	});
</script>

[附上下载链接](https://github.com/acdvorak/jquery.autosize)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值