OiO.lk Blog HTML keeping the current element in view when page content re-flows
HTML

keeping the current element in view when page content re-flows


I have a set of details/summary elements, with a javascript autoclose to keep the page sort – see https://codepen.io/perllaghu/pen/BaXwQOQ as a demonstration.

My problem is that when you have opened an early entry (try 1, 2, or 3) then open a later one (try anything after 4b), the top of the summary data [and thus the focus point] end up off the top of the page.

The jumps are visually worse when the length of the details content varies in length.

Does anyone have a clever way to keep the top of the newly opened item at the cursor point, or at least within the current view-port?



You need to sign in to view this answers

Exit mobile version