Scroll multiple divs based on anchor

  frontend, javascript, jquery, scroll

I would like to make multiple divs scrollable in JS/JQuery.
Let’s say that I have two divs on the same row, for which one has a lot of ID elements, which should be used as anchor for the movement of the second:

<div class="div-one">
  <ul>
    <li id="1"> One </li>
    <li id="2"> Two </li>
  </ul>
</div>
<div class="div-two">
  <p REF="1">Text here</p>
  <p REF="2">Text here</p>
</div>

I just put a REF tag (as a data-* attribute) to show the link between the entities.
How could obtain it? Thanks!

Source: Ask Javascript Questions

LEAVE A COMMENT