title: Action when element is off screen again with jQuery?
body: <p>I found this script that'll automatically play a video when the element is in the viewport </p>
  
  <pre><code>$(window).scroll(function() {
      $('#youtube-player-container').each(function(){
      var imagePos = $(this).offset().top;
  
      var topOfWindow = $(window).scrollTop();
          if (imagePos &lt; topOfWindow+600) {
              $('#youtube-player-container').tubeplayer("play");
          }
      });
  });
  </code></pre>
  
  <p>This works great, but I'd also like to pause the video again when it is no longer on screen. What would I need to edit/add to achieve this?</p>
  
  <p>EDIT: I know there is an action 'tubeplayer("pause") available, I just don't know how to activate it.</p>