Horizontal DIV with children elements to be scrolled to by Id

77 Views Asked by At

I have an ASP.NET Core Razor Page where is a collection of elements scroll-able horizontally on touch or on nav button click.

I am not js specialist and I need one more functionality: On button click, I need to "JUMP" to element that has given ID.

How can I achieve that on horizontal scroll div?

1

There are 1 best solutions below

0
Akin Okegbile On

This answer here can help. This is a quote from that answer

call this when you need to scroll the screen to an element which has id="yourSpecificElementId"

window.scroll(0,findPos(document.getElementById("yourSpecificElementId")));