More actions
(Created page with "→Any JavaScript here will be loaded for all users on every page load.: window.onscroll = function() {scrollFunction()}; function scrollFunction() { if (document.body.scrollTop > 50 || document.documentElement.scrollTop > 50) { document.getElementById("navbar").className = "scrolled"; } else { document.getElementById("navbar").className = ""; } }") |
No edit summary |
||
Line 10: | Line 10: | ||
} | } | ||
} | } | ||
document.getElementById('scrollTop').addEventListener('click', () => { | |||
window.scrollTo({ top: 0, behavior: 'smooth' }); | |||
}); |
Revision as of 19:06, 16 November 2024
/* Any JavaScript here will be loaded for all users on every page load. */ window.onscroll = function() {scrollFunction()}; function scrollFunction() { if (document.body.scrollTop > 50 || document.documentElement.scrollTop > 50) { document.getElementById("navbar").className = "scrolled"; } else { document.getElementById("navbar").className = ""; } } document.getElementById('scrollTop').addEventListener('click', () => { window.scrollTo({ top: 0, behavior: 'smooth' }); });