Guest User

Untitled

a guest
Jan 16th, 2018
96
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var fKeyCode = 70;
  2.  
  3. var isScrolledUp = function(el) {
  4.     var elementTop = $(el).offset().top;
  5.     var elementBottom = elementTop + $(el).outerHeight();
  6.     var viewportTop = $(window).scrollTop();
  7.     return elementBottom < viewportTop;
  8. };
  9.  
  10. document.body.addEventListener('keydown', function (e) {
  11.     if (e.keyCode == fKeyCode) {
  12.         $("article.story").each(function(i, el) {
  13.             if (isScrolledUp(el)) {
  14.                 $(el).remove();
  15.             }
  16.         });
  17.     }
  18. });
RAW Paste Data