title: Detecting scroll event of Iframe called by AJAX reqest
body: <p>i have a link in my main page that uses ajax to retrieve a PDF which is displayed in an Iframe, i am trying to detect scroll event of the PDF document and display a message or do something. i have tried different solutions from other solutions on stackoverflow and google search in general and couldn't find a good solution.</p>
  
  <p>Main.php</p>
  
  <pre><code> &lt;html&gt;
   &lt;!--ajax request--&gt;
   &lt;script type="text/javascript"&gt;
    $(document).on('click','#nextpdf',function(event) {
  
    event.preventDefault();
  
    var reg = $(this).attr("href");
    var str = reg.split('?')[1];
  
    $.ajax({
  
      type: "GET",
      url: '../functions/pdfreader.php',
      data: 'pdfxs='+str+'',
      cache:false,
        async: false,
       success: function(data) {
     // data is ur summary
    $('.refresh').html(data);
    return false;
          }
  
     });//end of ajax
  
        });
  
  
  &lt;/script&gt;
    &lt;?php
  
       while($obj = $c_content-&gt;fetch())
   {
     $title = $obj['lecture_title'];
  
      echo '&lt;article class="comment2"&gt;
  
      //pdf link
     &lt;div class="comment2-body"&gt;
  &lt;div class="text" style="color:#999;padding-right:130px;"&gt;
    &lt;p&gt;&lt;a href="../functions/pdfreader.php?'.$title.'"" 
    style="color:#999" id="nextpdf"&gt;'.$title.'&lt;/a&gt;&lt;/p&gt;
     &lt;/div&gt;
  &lt;/div&gt;
   &lt;/article&gt;
     ';
  
      }
  
      ?&gt;
      &lt;/html&gt;
  </code></pre>
  
  <p>pdfreader.php</p>
  
  <pre><code>//detect iframe pdf scroll
                 &lt;script type="text/javascript"&gt;
       $("myiframe").load(function () {
       var iframe = $("myiframe").contents();
  
       $(iframe).scroll(function () { 
        alert('scrolling...');
          });
             });
          &lt;/script&gt;
  
    &lt;?php
  
  
  
           ........
          while($obj = $gettrend-&gt;fetch())
      {
         $coursefile = $obj['lecture_content'];
            //this is my iframe
         echo '&lt;div class="mov_pdf_frame"&gt;&lt;iframe id="myiframe"
        src="https://localhost/einstower/e-learn/courses/pdf/'.$coursefile.'" 
        id="pdf_content"
       width="700px" height="800px" type="application/pdf"&gt;
         &lt;/iframe&gt;&lt;/div&gt;';
               }
                   ?&gt;
  </code></pre>
  
  <p>The major problem here is that nothing happens when i scroll the pdf document, how can i detect scrolling?</p>
  
  <p>i found this fiddle that works but i cant view the javascript solution. <a href="http://fiddle" rel="noreferrer">http://fiddle.jshell.net/czw8pbvj/1/</a></p>