feat(ui): add smooth collapse animation for subscriptions list
Replace display toggle with CSS transitions for subscriptions list collapse
This commit is contained in:
@@ -200,6 +200,10 @@ body {
|
|||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.nav-section-title i {
|
||||||
|
transition: transform 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
.nav-btn {
|
.nav-btn {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@@ -231,6 +235,16 @@ body {
|
|||||||
|
|
||||||
.subscriptions-list {
|
.subscriptions-list {
|
||||||
padding: 0 12px;
|
padding: 0 12px;
|
||||||
|
max-height: 500px;
|
||||||
|
overflow: hidden;
|
||||||
|
transition: max-height 0.3s ease, opacity 0.3s ease;
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.subscriptions-list.collapsed {
|
||||||
|
max-height: 0;
|
||||||
|
opacity: 0;
|
||||||
|
padding: 0 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.subscription-item {
|
.subscription-item {
|
||||||
|
|||||||
10
js/script.js
10
js/script.js
@@ -778,12 +778,12 @@ function bindEvents() { // Bind events to the DOM elements
|
|||||||
const subscriptionsList = document.querySelector('.subscriptions-list');
|
const subscriptionsList = document.querySelector('.subscriptions-list');
|
||||||
const chevron = subscriptionTitle.querySelector('i');
|
const chevron = subscriptionTitle.querySelector('i');
|
||||||
|
|
||||||
if (subscriptionsList.style.display === 'none') {
|
subscriptionsList.classList.toggle('collapsed');
|
||||||
subscriptionsList.style.display = 'block';
|
|
||||||
chevron.style.transform = 'rotate(0deg)';
|
if (subscriptionsList.classList.contains('collapsed')) {
|
||||||
} else {
|
|
||||||
subscriptionsList.style.display = 'none';
|
|
||||||
chevron.style.transform = 'rotate(-90deg)';
|
chevron.style.transform = 'rotate(-90deg)';
|
||||||
|
} else {
|
||||||
|
chevron.style.transform = 'rotate(0deg)';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user