Now there is such code , and, it would seem, it works as it should:
elem.style.top = this._coords.tops[step] + "px"; elem.style.left = this._coords.lefts[step] + "px"; elem.style.width = this._coords.widths[step] + "px"; elem.style.height = this._coords.heights[step] + "px"; Blocks are highlighted, by clicking on next, the transition to the next block is performed. In short, everything is fine. But there is one BUT (where without them?). If before the beginning of the script (in this case, the trigger is the "Start" button (so that the codepen does not have to refresh the page every time), and so the page loads), the page is slightly scrolled, then from the very beginning the selection block (with a red frame) is slightly offset, and specifically exactly as much as the page is scrolled. How to avoid such behavior?
That is, I need to get the position (and width with height) of the current element (selected), while scrolling the page. Or rather, it is better to even make sure that it doesn’t affect anything (perhaps just use the getBudleClientRect() alternative function. What is the question ).
PS All the code is on the link above.

