Try automatic resizing of elements

This commit is contained in:
Eliot Whalan 2016-06-24 16:40:17 +10:00
parent 986a0fcd16
commit 725cd30069
No known key found for this signature in database
GPG Key ID: C0A42175139840D6
1 changed files with 6 additions and 10 deletions

View File

@ -52,21 +52,17 @@
<script src="https://cdn.jsdelivr.net/bootstrap.material-design/0.5.10/js/ripples.min.js" integrity="sha256-TY/EO/++Ug/P+fSBjaqlmtuphCBKwlP7TOnS+SGnN8g=" crossorigin="anonymous"></script>
<script>
$.material.init();
var offset = this.offsetHeight - this.clientHeight;
var resizeTextarea = function(el) {
jQuery(el).css('height', 'auto').css('height', el.scrollHeight + offset);
};
jQuery.each(jQuery('textarea[data-autoresize]'), function() {
jQuery(this).on('keyup input', function() { resizeTextarea(this); });
var offset = this.offsetHeight - this.clientHeight;
var resizeTextarea = function(el) {
jQuery(el).css('height', 'auto').css('height', el.scrollHeight + offset);
};
resizeTextarea(this);
});
$( document ).ready(function() {
$('textarea[data-autoresize]').each(function(){
resizeTextarea(this);
});
});
</script>
</body>