File size: 1,993 Bytes
d9c9757 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | const open = document.querySelector(".mob-open");
const close = document.querySelector(".mob-close");
const wrapper = document.querySelector(".mob-wrapper").classList;
open.addEventListener("click", () => {
wrapper.toggle("opened");
wrapper.toggle("closed");
});
close.addEventListener("click", () => {
wrapper.toggle("opened");
wrapper.toggle("closed");
});
//Active Link Highlighting
const imageClassificationLink = document.getElementById('image-classification-link');
const aboutLink = document.getElementById('about-link');
const imageClassificationLinkMob = document.getElementById('image-classification-link-mob');
const aboutLinkMob = document.getElementById('about-link-mob');
function setActiveLink(link) {
imageClassificationLink.classList.remove('active');
aboutLink.classList.remove('active');
imageClassificationLinkMob.classList.remove('active');
aboutLinkMob.classList.remove('active');
link.classList.add('active');
}
aboutLink.addEventListener('click', () => {
setActiveLink(aboutLink);
});
aboutLinkMob.addEventListener('click', () => {
setActiveLink(aboutLinkMob);
});
imageClassificationLink.addEventListener('click', () => {
setActiveLink(imageClassificationLink);
});
imageClassificationLinkMob.addEventListener('click', () => {
setActiveLink(imageClassificationLinkMob);
});
//Error Alert When Navigating to About while Image Classification is running
aboutLink.addEventListener('click', (e) => {
if (progress.style.display === 'block' && progressBar.value !== 100) {
e.preventDefault();
setActiveLink(imageClassificationLink);
alert('Please wait until the upload is complete before navigating away.');
}
});
aboutLinkMob.addEventListener('click', (e) => {
if (progress.style.display === 'block' && progressBar.value !== 100) {
e.preventDefault();
setActiveLink(imageClassificationLink);
alert('Please wait until the upload is complete before navigating away.');
}
}); |