Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Our Events Card Glitch After Toggling and Resizing Window #6777

Merged
merged 3 commits into from
May 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 18 additions & 9 deletions assets/js/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,27 @@
}
}
}
document.querySelector('.flex-page-card').addEventListener('resize',handleScreenResize)
function handleScreenResize(){
if(document.body.clientWidth>767){
const columns = document.querySelectorAll('.mobile-dropdown');
for(let column of columns){
window.addEventListener('resize', handleScreenResize);

/**
* Handles the screen resize event for event cards
* When the screen width is greater than 767 pixels (tablet/desktop), disables mobile dropdown, removes the arrow and display card content
* When the screen width is less than or equal to 767 pixels (mobile), enables cards mobile dropdown and fold the cards, unless already unfolded ('active').
*/
function handleScreenResize() {
const columns = document.querySelectorAll('.mobile-dropdown');

if (document.body.clientWidth > 767) {
for(let column of columns) {
column.style.display='block';
column.previousElementSibling.classList.remove('active');
}
}
else{
const columns = document.querySelectorAll('.mobile-dropdown');
for(let column of columns){
} else {
for (let column of columns) {
if (column.previousElementSibling.classList.contains('active')) {
// when collapsing cards, skip the ones unfolded manually
continue;
}
column.style.display='none';
}
}
Expand Down