Scrolling to top of page on reload after "Next" button click

amitycol 21 Sep, 2023
I'm trying to work out a way to overcome page auto-scrolling to the top after every click on Next/Prev buttons of a multipage form. Forces the user to have to scroll down to the bottom of the page where the form is loaded after each navigation click (if they can decipher what has happened). I thought the loading of pages would be by jquery.
Max_admin 27 Sep, 2023
Answer
you can add the following JS code in a JS view to your "next" page:

document.addEventListener("DOMContentLoaded", function (event) {
	window.scrollTo({
			top: document.querySelector(".chronoform").getBoundingClientRect().top,
			behavior: "smooth"
		});
})

this code is for v7 and can be improved if you use v8 because there is a core function for that
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
You need to login to be able to post a reply.