title: synchronize the scrollbars of two iframes containing pdf
body: <p>I have a task to launch 2 pdf's in a single html page and do the pdf's comparsion side by side, so I have create 2 iframes for each comparing, however I have a problem on sync the scroll bar behaviour, like when I move the vertical scroll bar on the left side web page(iframe1), then the scroll bar on right side web page(iframe2) will move as well. Is there anyone know how to do it? or other method beside using iframe, but available to launch 2 web pages and sync the scroll bar? Thanks in advance.</p>
  <p>Here is the code im trying</p>
  <pre><code>&lt;html&gt;
     &lt;head&gt;
        &lt;script src=&quot;http://code.jquery.com/jquery-1.3.2.js&quot;&gt;&lt;/script&gt;
        &lt;style&gt;
           .container {
           width: 80%;
           height: 200px;
           margin: auto;
           padding: 10px;
           }
           .div1 {
           width: 15%;
           height: 200px;
           float: left;
           overflow:auto;
           border:1px solid black;
           }
           .div2 {
           margin-left: 15%;
           width: 15%;
           height: 200px;
           overflow:auto;
           border:1px solid black;
           }
        &lt;/style&gt;
        &lt;SCRIPT&gt;
           $(document).ready(function()
           {
           $(&quot;#div1&quot;).scroll(function () { 
                   $(&quot;#div2&quot;).scrollTop($(&quot;#div1&quot;).scrollTop());
                   $(&quot;#div2&quot;).scrollLeft($(&quot;#div1&quot;).scrollLeft());
               });
           $(&quot;#div2&quot;).scroll(function () { 
                   $(&quot;#div1&quot;).scrollTop($(&quot;#div2&quot;).scrollTop());
                   $(&quot;#div1&quot;).scrollLeft($(&quot;#div2&quot;).scrollLeft());
               });
           $($(&quot;#iframe1&quot;).contents()).scroll(function(){
           $($(&quot;#iframe2&quot;).contents()).scrollTop($(this).scrollTop());
           }); 
           
           });
           
        &lt;/SCRIPT&gt;
     &lt;/head&gt;
     &lt;body&gt;
        &lt;section class=&quot;container&quot;&gt;
           &lt;div id=&quot;div1&quot; class=&quot;div1&quot;&gt;
              &lt;iframe id=&quot;iframe1&quot; src=&quot;sample.pdf&quot; style=&quot;width:600px; height:500px;&quot;&gt;&lt;/iframe&gt;
           &lt;/div&gt;
           &lt;div id=&quot;div2&quot; class=&quot;div2&quot;&gt;
              &lt;iframe id=&quot;iframe2&quot; src=&quot;sample.pdf&quot; style=&quot;width:600px; height:500px;&quot;&gt;&lt;/iframe&gt;
           &lt;/div&gt;
        &lt;/section&gt;
     &lt;/body&gt;
  &lt;/html&gt;
  
  </code></pre>