Manually invoke scroll without link

Is there a way to use custom code to manually invoke a scroll to a specific target? I would like the user to scroll to a specific page section when he clicks a submit button. I tried to assign an ID to the submit button and the use $(“body”).ScrollTo(‘#target’); but that doesn’t work.

Any ideas on this?

If I understand it correctly, the button is a Form button?

Then:
I think its possible if the user stays on the same page by using an interaction. If you use the “onclick” as a trigger, you can send the page up or down by a certain amount of pixels, or percentages.

A second option is to make the redirect url from the form to go to: pagename.html/#anchor if you go to a new page. Use the /#anchor (or #anchor, i’m not sure) to stay on current page.

Third: If the button isn’t a form button but just any ordinary button, then the target of the button could be to an anchor too.

btw. anchors are defined here:

Thanks for you answer. I tried the redirect but that doesn’t work. It says it can’t find the section.

Interactions do not allow for page scrolling as far as I know?

Never mind. I already got it working. Turns out I misspelled the ID in the custom code section.
Couldn’t get it to work using redirect or interactions though.

Thanks for the help.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.