more JS 💀

This commit is contained in:
Michał 2023-04-19 18:04:32 +00:00
parent 0cc5f70e4f
commit 9e788b0cec
3 changed files with 10 additions and 11 deletions

View file

@ -9,7 +9,7 @@ function loadOnView() {
const webpSupport = checkWebpSupport();
for (let i = 0; i < lazyLoad.length; i++) {
let image = lazyLoad[i];
const image = lazyLoad[i];
if (image.getBoundingClientRect().top < window.innerHeight && image.getBoundingClientRect().bottom > 0) {
if (!image.src && webpSupport) {
image.src = `${image.getAttribute('data-src')}&e=webp`;

View file

@ -10,11 +10,11 @@ function addNotification(notificationText, notificationLevel) {
// Create notification element
const notification = document.createElement('div');
notification.classList.add('sniffle__notification');
notification.onclick = function() {
notification.onclick = () => {
if (notification) {
notification.classList.add('hide');
setTimeout(function() {
setTimeout(() => {
notificationContainer.removeChild(notification);
}, 500);
}
@ -48,15 +48,14 @@ function addNotification(notificationText, notificationLevel) {
// Append notification to container
notificationContainer.appendChild(notification);
setTimeout(function() { notification.classList.add('show'); }, 5);
setTimeout(() => { notification.classList.add('show'); }, 5);
// Remove notification after 5 seconds
setTimeout(function() {
setTimeout(() => {
if (notification) {
notification.classList.add('hide');
setTimeout(function() {
notificationContainer.removeChild(notification);
setTimeout(() => {
notificationContainer.removeChild(notification);
}, 500);
}
}, 5000);

View file

@ -14,7 +14,7 @@ function openUploadTab() {
// Stop scrolling and open upload tab
document.querySelector("html").style.overflow = "hidden";
uploadTab.style.display = "block";
setTimeout(function () { uploadTab.classList.add("open"); }, 5);
setTimeout(() => { uploadTab.classList.add("open"); }, 5);
}
// close upload tab
@ -25,7 +25,7 @@ function closeUploadTab() {
// un-Stop scrolling and close upload tab
document.querySelector("html").style.overflow = "auto";
uploadTab.classList.remove("open");
setTimeout(function () {
setTimeout(() => {
uploadTab.style.display = "none";
uploadTabContainer.style.transform = "";
@ -76,7 +76,7 @@ function tabDragStopped(event) {
} else {
uploadTab.style.transition = "transform 0.25s cubic-bezier(0.76, 0, 0.17, 1)";
uploadTab.style.transform = "translateY(0px)";
setTimeout(function () { uploadTab.style.transition = ""; }, 250);
setTimeout(() => { uploadTab.style.transition = ""; }, 250);
}
}