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;
|
||||
|
||||
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
|
||||
|
@ -29,9 +31,11 @@ function textareaAutosizeIinit($) {
|
|||
var $window = $(window);
|
||||
var currentScrollPosition = $window.scrollTop();
|
||||
|
||||
let height = this.scrollHeight - diff;
|
||||
height = 24 * Math.round(height / 24)
|
||||
$(this)
|
||||
.height(0)
|
||||
.height(this.scrollHeight - diff);
|
||||
.height(height);
|
||||
|
||||
$window.scrollTop(currentScrollPosition);
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue
Block a user