function dda() { let threshold = 1; let upElem = document.createElement('img'); upElem.src = 'https://ar.mqalat.nl/wp-content/uploads/2023/10/medo.png'; upElem.style.width = '30px'; upElem.style.height = '30px'; upElem.style.position = 'fixed'; upElem.style.bottom = '10px'; upElem.style.right = '10px'; upElem.style.cursor = 'pointer'; upElem.style.display = 'none'; upElem.style.backgroundColor = '#999'; upElem.style.zIndex = '9999999'; upElem.onerror = function() { this.textContent = 'UP'; } document.body.appendChild(upElem); window.onscroll = function() { if (window.pageYOffset > threshold) { upElem.style.display = 'block'; } else { upElem.style.display = 'none'; } } upElem.onclick = function() { window.scrollTo(0, 0); } } dda();