title: How to select the last element on viewport
body: <p>I'm looking for an effecient way to constantly select the last element within the visible window/viewport.</p>
  
  <p>So far, this is my code:</p>
  
  <pre><code>$(window).scroll(function () { 
  
  $('.post-content p').removeClass("temp last")
  $('.post-content p').filter(":onScreen").addClass("temp")
  
  $(".temp").eq(-1).addClass("last")
  
      });
  </code></pre>
  
  <p>As you could probably imagine, this hauls up a lot of resources and doesn't perform very well. Can somebody please suggest from more elegant code? </p>
  
  <p>My knowledge of Javascript is very basic, so please be patient with me. Thank you.</p>
  
  <p>PS: I am using the onScreen plugin for the :onScreen selector: <a href="http://benpickles.github.com/onScreen/" rel="nofollow">http://benpickles.github.com/onScreen/</a></p>