Skip to content

Instantly share code, notes, and snippets.

@KevinAlavik
Last active August 6, 2023 18:23
Show Gist options
  • Save KevinAlavik/b9e7c470d9c03fd4e6628e1c525a5651 to your computer and use it in GitHub Desktop.
Save KevinAlavik/b9e7c470d9c03fd4e6628e1c525a5651 to your computer and use it in GitHub Desktop.
Simple page switching function
let displayType = 'flex';
function switchPage(page) {
const pages = document.querySelectorAll('.page-container');
for (let i = 0; i < pages.length; i++) {
if (pages[i].getAttribute('page') === page) {
pages[i].style.display = displayType;
} else {
pages[i].style.display = 'none';
}
}
}
@KevinAlavik
Copy link
Author

KevinAlavik commented Jun 3, 2023

To use any other displaytype other the flex just change the variable!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment