$(document).ready(function(){ // Scroll to first error if any var firstError = $('.is-invalid').first(); if(firstError.length){ $('html, body').animate({ scrollTop: firstError.offset().top - 100 }, 500); firstError.focus(); } }); document.addEventListener("DOMContentLoaded", function () { const successMsg = document.getElementById("form-success"); if (successMsg) { successMsg.scrollIntoView({ behavior: "smooth", block: "center" }); } }); AOS.init({ duration: 1000, once: true })