mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-15 01:32:57 -07:00
Fix auto resizing textareas scrolling to the top on focus
This commit is contained in:
parent
ce2982d948
commit
ab92e48d2e
2 changed files with 6 additions and 0 deletions
|
@ -766,9 +766,12 @@
|
||||||
|
|
||||||
// auto resizing textarea for custom notification message body
|
// auto resizing textarea for custom notification message body
|
||||||
$('textarea[data-autoresize]').each(function () {
|
$('textarea[data-autoresize]').each(function () {
|
||||||
|
var modal_body = $(this).closest('.modal-body');
|
||||||
var offset = this.offsetHeight - this.clientHeight;
|
var offset = this.offsetHeight - this.clientHeight;
|
||||||
var resizeTextarea = function (el) {
|
var resizeTextarea = function (el) {
|
||||||
|
var modal_offset = modal_body.scrollTop();
|
||||||
$(el).css('height', 'auto').css('height', el.scrollHeight + offset);
|
$(el).css('height', 'auto').css('height', el.scrollHeight + offset);
|
||||||
|
modal_body.scrollTop(modal_offset);
|
||||||
};
|
};
|
||||||
$(this).on('focus keyup input', function () { resizeTextarea(this); }).removeAttr('data-autoresize');
|
$(this).on('focus keyup input', function () { resizeTextarea(this); }).removeAttr('data-autoresize');
|
||||||
});
|
});
|
||||||
|
|
|
@ -811,9 +811,12 @@
|
||||||
|
|
||||||
// auto resizing textarea for custom notification message body
|
// auto resizing textarea for custom notification message body
|
||||||
$('textarea[data-autoresize]').each(function () {
|
$('textarea[data-autoresize]').each(function () {
|
||||||
|
var modal_body = $(this).closest('.modal-body');
|
||||||
var offset = this.offsetHeight - this.clientHeight;
|
var offset = this.offsetHeight - this.clientHeight;
|
||||||
var resizeTextarea = function (el) {
|
var resizeTextarea = function (el) {
|
||||||
|
var modal_offset = modal_body.scrollTop();
|
||||||
$(el).css('height', 'auto').css('height', el.scrollHeight + offset);
|
$(el).css('height', 'auto').css('height', el.scrollHeight + offset);
|
||||||
|
modal_body.scrollTop(modal_offset);
|
||||||
};
|
};
|
||||||
$(this).on('focus keyup input', function () { resizeTextarea(this); }).removeAttr('data-autoresize');
|
$(this).on('focus keyup input', function () { resizeTextarea(this); }).removeAttr('data-autoresize');
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue