$('textarea').each(function(){
this.setAttribute('style', 'height:' + (this.scrollHeight) + 'px;overflow-y:hidden;');
}).on('input',function(){
this.style.height = 'auto';
this.style.height = (this.scrollHeight) + 'px';
})
返回顶部:
//返回顶部
$(window).scroll(function(){
var sc=$(window).scrollTop();
if(sc>300){
$(".gethome").fadeIn();
}else{
$(".gethome").fadeOut();
}
})
$(".gethome").click(function(){
var sc=$(window).scrollTop();
$('body,html').animate({scrollTop:0},300);
})