Skip to content

Commit

Permalink
change duration
Browse files Browse the repository at this point in the history
  • Loading branch information
yuma140902 committed Dec 27, 2023
1 parent 26ba2ce commit fc98055
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,18 +103,18 @@ function handleSidebar() {
sidebar_toggle.addEventListener('click', () => {
sidebar_open = !sidebar_open;
if (sidebar_open) {
openSidebar();
openSidebar(0.3);
}
else {
closeSidebar();
closeSidebar(0.3);
}
});

if (sidebar_open) {
openSidebar();
openSidebar(0);
}
else {
closeSidebar();
closeSidebar(0);
}

const current_page_item = document.querySelector('#sidebar .here');
Expand All @@ -123,22 +123,22 @@ function handleSidebar() {
}
}

function openSidebar() {
function openSidebar(duration) {
const sidebar = document.querySelector('#sidebar');
const dummy = document.querySelector('#sidebar-dummy');
sidebar.hidden = false;
gsap.to(dummy, {
duration: 0.5,
duration: duration,
ease: 'power2.out',
"--sidebar-width": '200px',
});
}

function closeSidebar() {
function closeSidebar(duration) {
const sidebar = document.querySelector('#sidebar');
const dummy = document.querySelector('#sidebar-dummy');
gsap.to(dummy, {
duration: 0.5,
duration: duration,
ease: 'power2.out',
"--sidebar-width": '0px',
onComplete: () => {
Expand Down

0 comments on commit fc98055

Please sign in to comment.