textarea 自适应内容高度

xiaoxiao2021-02-28  74

$('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); })

转载请注明原文地址: https://www.6miu.com/read-80761.html

最新回复(0)