In one of my webpage sections, there are dropdowns and images at the top followed by a price grid below the fold. This price grid is contained within a scrollable div element. Initially, upon loading, a price in the grid is already selected but hidden, so the user must scroll down to view it.
My dilemma lies in wanting to automatically scroll the table inside the div to display the active selection without causing the entire page to scroll as well. The goal is for the user not to notice any movement upon page load; rather, they should only see the active choice once scrolling down naturally. Essentially, I aim to have the table scroll to reveal the active row discreetly (below the fold) first, then become visible to the user only when they manually navigate further down the page.
const activeRow = $('#prices_table').find('tr td.active');
activeRow[0].scrollIntoView({block: 'center', behavior: 'smooth' });
The issue with my current code is that it immediately scrolls both the page and the price grid when ideally, I want users to be able to scroll to the grid themselves without interference from automatic scrolling. Various solutions I've come across do involve scrolling the entire page prior to focusing on the div, which isn't suitable for my requirements.