From 594aa45ec14a4838f54c5c77e9e19d16660b45e3 Mon Sep 17 00:00:00 2001 From: Hana Jung Date: Tue, 6 Aug 2024 16:38:32 +0900 Subject: [PATCH] =?UTF-8?q?=ED=82=A4=ED=8C=A8=EB=93=9C=20=ED=85=8C?= =?UTF-8?q?=EC=8A=A4=ED=8A=B83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MAWPUB/view/html/com/com/com/test.html | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/MAWPUB/view/html/com/com/com/test.html b/MAWPUB/view/html/com/com/com/test.html index b06c976..27e2bf0 100644 --- a/MAWPUB/view/html/com/com/com/test.html +++ b/MAWPUB/view/html/com/com/com/test.html @@ -19,6 +19,7 @@ height: 0; transition: height 0.5s linear; } + #wrap {overflow: auto;} @@ -158,7 +159,7 @@

- +
@@ -257,20 +258,20 @@

triggerKeyboardOpen(event.currentTarget.height); } -// make-scrollale 객체 추가 +// make-scrollable 객체 추가 function appendScrollElement() { const scrollElement = document.createElement('div'); - scrollElement.setAttribute("id", "make-scrollale"); + scrollElement.setAttribute("id", "make-scrollable"); document.querySelector('#wrap').appendChild(scrollElement); } function onFocus() { - document.querySelector("#make-scrollale").style.height = "calc(100% + 1px)"; + document.querySelector("#make-scrollable").style.height = "calc(100% + 1px)"; document.querySelector('#wrap').style.overflow = "hidden"; } function onFocusOut() { - document.querySelector("#make-scrollale").style.height = "0"; + document.querySelector("#make-scrollable").style.height = "0"; document.querySelector('#wrap').style.overflow = ""; } @@ -286,13 +287,10 @@

} function scrollToActiveElement() { - // document.activeElement parent id contain wrap - if (document.activeElement.parentElement.id.includes('wrap')) { - document.activeElement.parentElement.scrollIntoView(true); - } - else { - document.activeElement.scrollIntoView(true); - } + var viewScrollHeight = document.querySelector('#wrap').scrollHeight; + var offset = viewScrollHeight - window.visualViewport.height ; + + document.querySelector('#wrap').scrollTo(0, offset); }