Skip to content

Commit

Permalink
Fix textarea height
Browse files Browse the repository at this point in the history
  • Loading branch information
ohno committed May 26, 2024
1 parent 80a2617 commit 3f059a0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion assets/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ footer {

@media screen and (max-width:840px) {
.textareas__block__main {
height: 300px;
/* height: 300px; */
width: 100%;
}
}
Expand Down
6 changes: 5 additions & 1 deletion assets/js/math.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@ function math(input) {
// update URL
url(input);
// update textarea size
const lines = (document.getElementById('input').value + '\n').match(/\n/g).length;
document.getElementById('input').rows = lines;
var Hin = document.getElementById('input').scrollHeight;
var Hout = document.getElementById('output').scrollHeight;
document.getElementById('input').height = (Math.max(Hin, Hout)*2) + "px";
document.getElementById('input').height = (Math.max(Hin, Hout)) + " px";
document.getElementById('output').height = (Math.max(Hin, Hout)) + " px";
console.log(document.getElementById('input').height);
console.log(document.getElementById('output').height);
console.log(document.getElementById('input').scrollHeight);

// update LaTeX
Expand Down

0 comments on commit 3f059a0

Please sign in to comment.