I have a <div>
with a fixed height and overflow-y: scroll
. Inside this div, I have primarily a <p>
tag containg a long text with some highlithing (spans with background-color and a numbered id attribute).
By the way, it is a HTMl5 application with AngularJS.
Now I like to implement a button to jump through the highlighted positions: I like to get the div scrolled to the right position and the rest of the page shall stay untouched i.e. "unscrolled". How can I achieve that the div is scrolled to the right position and not the whole page is scrolled down disturbing the page layout?
On principle, I know that I can use hashtag + id in the url to go to the element with a given id - I also found $anchorScroll from AngularJS but it seems not to be the right way, since it scrolles down the whole browser content instead of just inside my scrollable div.
Years ago, as using an iframe was not ugly, it was easy to use an iframe for this; however, today, I think there must be better solutions.
Any help is appreciated! Thanks in advance.