diff options
Diffstat (limited to 'assets')
-rw-r--r-- | assets/css/site.css | 1 | ||||
-rw-r--r-- | assets/css/tailwind.config.js | 5 | ||||
-rw-r--r-- | assets/js/eureka.js | 20 |
3 files changed, 24 insertions, 2 deletions
diff --git a/assets/css/site.css b/assets/css/site.css index 288edb5..817d608 100644 --- a/assets/css/site.css +++ b/assets/css/site.css @@ -1,6 +1,5 @@ .sticky-toc { @apply sticky z-0 ease-in-out duration-300; - top: 8rem; } .sticky-toc a { diff --git a/assets/css/tailwind.config.js b/assets/css/tailwind.config.js index 20eee7d..bbf719d 100644 --- a/assets/css/tailwind.config.js +++ b/assets/css/tailwind.config.js @@ -20,8 +20,13 @@ module.exports = { minHeight: { '16': '4rem', }, + maxHeight: { + 'doc-sidebar': 'calc(100vh - 4rem - var(--height-doc-title, 4rem))', + }, inset: { '16': '4rem', + '32': '8rem', + '48': '12rem', }, colors: { 'eureka': 'var(--color-eureka)', diff --git a/assets/js/eureka.js b/assets/js/eureka.js index 117f934..d88c228 100644 --- a/assets/js/eureka.js +++ b/assets/js/eureka.js @@ -190,7 +190,7 @@ function switchDarkMode(e) { } } -//swithch burger +//switch burger function switchBurger() { let element = document.getElementById('navbar-btn'); let screen = document.getElementById('is-open-mobile'); @@ -227,4 +227,22 @@ function switchLanguage() { targetDiv.classList.toggle('hidden') screen.classList.toggle('hidden') }) +} + +//switch doc toc +function switchDocToc() { + let element = document.getElementById('sidebar-title'); + let target = document.getElementById('sidebar-toc'); + element.addEventListener('click', () => { + target.classList.toggle('hidden'); + element.lastElementChild.classList.toggle('fa-caret-right'); + element.lastElementChild.classList.toggle('fa-caret-down'); + }) +} + +//change sidebar height +function changeSidebarHeight() { + let element = document.getElementById('sidebar-title'); + let target = document.getElementById('sidebar-toc'); + target.style.setProperty('--height-doc-title', `${element.offsetHeight}px`); }
\ No newline at end of file |