Instruct style improvements (#4951)
This commit is contained in:
parent
41424907b1
commit
7a84d7b2da
3 changed files with 46 additions and 19 deletions
14
js/main.js
14
js/main.js
|
@ -123,6 +123,8 @@ targetElement.addEventListener("scroll", function() {
|
|||
// Create a MutationObserver instance
|
||||
const observer = new MutationObserver(function(mutations) {
|
||||
mutations.forEach(function(mutation) {
|
||||
updateChatHeight();
|
||||
|
||||
if(!isScrolled) {
|
||||
targetElement.scrollTop = targetElement.scrollHeight;
|
||||
}
|
||||
|
@ -373,3 +375,15 @@ function toggleBigPicture() {
|
|||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------
|
||||
// Define the --chat-height global CSS variable to
|
||||
// the height of the chat parent
|
||||
//------------------------------------------------
|
||||
function updateChatHeight() {
|
||||
const chatContainer = document.getElementById('chat').parentNode.parentNode.parentNode;
|
||||
const newChatHeight = `${chatContainer.clientHeight}px`;
|
||||
|
||||
document.documentElement.style.setProperty('--chat-height', newChatHeight);
|
||||
}
|
||||
|
||||
window.addEventListener('resize', updateChatHeight);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue