Try onload resizing with jquery
This commit is contained in:
parent
556f953637
commit
7627cfa15a
|
@ -53,15 +53,20 @@
|
||||||
<script>
|
<script>
|
||||||
$.material.init();
|
$.material.init();
|
||||||
|
|
||||||
$( document ).ready(function() {
|
jQuery.each(jQuery('textarea[data-autoresize]'), function() {
|
||||||
jQuery.each(jQuery('textarea[data-autoresize]'), function() {
|
|
||||||
var offset = this.offsetHeight - this.clientHeight;
|
var offset = this.offsetHeight - this.clientHeight;
|
||||||
|
|
||||||
var resizeTextarea = function(el) {
|
var resizeTextarea = function(el) {
|
||||||
jQuery(el).css('height', 'auto').css('height', el.scrollHeight + offset);
|
jQuery(el).css('height', 'auto').css('height', el.scrollHeight + offset);
|
||||||
};
|
};
|
||||||
jQuery(this).on('keyup input', function() { resizeTextarea(this); }).removeAttr('data-autoresize');
|
jQuery(this).on('keyup input', function() { resizeTextarea(this); });
|
||||||
});});
|
});
|
||||||
|
|
||||||
|
$( document ).ready(function() {
|
||||||
|
$('textarea[data-autoresize]').each(function(){
|
||||||
|
resizeTextarea(this);
|
||||||
|
});
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
Loading…
Reference in New Issue