console.log("everything is still smooth") function scrollToTheme() { var uploadsuccessful = document.getElementById("uploadsuccessful"); if(uploadsuccessful){ const theme = document.getElementById('theme') theme.scrollIntoView({ behavior: 'smooth', block: 'start' }); } } function scrollToLaunch() { var cssSelected = document.getElementById("cssSelected"); if(cssSelected){ const launch = document.getElementById('launch') launch.scrollIntoView({ behavior: 'smooth', block: 'end' }); } } document.addEventListener("DOMContentLoaded", scrollToTheme); document.addEventListener("DOMContentLoaded", scrollToLaunch); // function(e) { // (e.keyCode === 13 || e.keyCode === 32) && $(this).trigger("click") // }