Fix height of textarea to multiple of 24px
This commit is contained in:
parent
47d504903d
commit
c92adb32d3
|
@ -21,7 +21,9 @@ function textareaAutosizeIinit($) {
|
||||||
parseInt(this.$element.css('borderBottomWidth')) || 0;
|
parseInt(this.$element.css('borderBottomWidth')) || 0;
|
||||||
|
|
||||||
if (containsText(this.element.value)) {
|
if (containsText(this.element.value)) {
|
||||||
this.$element.height(this.element.scrollHeight - diff);
|
let height = this.element.scrollHeight - diff;
|
||||||
|
height = 24 * Math.round(height / 24)
|
||||||
|
this.$element.height(height);
|
||||||
}
|
}
|
||||||
|
|
||||||
// keyup is required for IE to properly reset height when deleting text
|
// keyup is required for IE to properly reset height when deleting text
|
||||||
|
@ -29,9 +31,11 @@ function textareaAutosizeIinit($) {
|
||||||
var $window = $(window);
|
var $window = $(window);
|
||||||
var currentScrollPosition = $window.scrollTop();
|
var currentScrollPosition = $window.scrollTop();
|
||||||
|
|
||||||
|
let height = this.scrollHeight - diff;
|
||||||
|
height = 24 * Math.round(height / 24)
|
||||||
$(this)
|
$(this)
|
||||||
.height(0)
|
.height(0)
|
||||||
.height(this.scrollHeight - diff);
|
.height(height);
|
||||||
|
|
||||||
$window.scrollTop(currentScrollPosition);
|
$window.scrollTop(currentScrollPosition);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user