0

i want to scroll 2 iframes simultaneously in the web page. Is there a way to do that? I have tried a lot but didn't find any solution.

$('#one').contentwindow.scrollTop = $('two').contentwindow.scrollTop;
$('#two').contentwindow.scrollTop = $('one').contentwindow.scrollTop;
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

<table>
  <tr>
    <td>
      <iframe id="one" src="http://api.jquery.com/scroll/" style="width: 300px; height: 400px;"></iframe>
    </td>
    <td>
      <iframe id="two" src="http://api.jquery.com/scroll/" style="width: 300px; height: 400px;"></iframe>
    </td>
  </tr>
</table>

Note: My question here is how to synchronize scrolling with 2 iframe within the Table not DIV

Karthick Gunasekaran
  • 2,697
  • 1
  • 15
  • 25
  • Ur code just sets the scrollTops once when page is loaded... you should update the scrollTops everytime scroll event occurs – Ahs N Jun 23 '16 at 13:00
  • 1
    Possible duplicate of [How do I synchronize the scroll position of two divs?](http://stackoverflow.com/questions/9236314/how-do-i-synchronize-the-scroll-position-of-two-divs) – Geoff James Jun 23 '16 at 13:23
  • Check this http://stackoverflow.com/questions/762274/how-to-synchronize-scrolling-positions-for-several-iframes – neer Jun 23 '16 at 13:24
  • @AhsN Thanks for your help. can you please update the code snippet? – Karthick Gunasekaran Jun 24 '16 at 05:29

0 Answers0