Jump to top when at bottom

by secretgspot

CSS

body { height: 2000px; background: grey; }

JavaScript

$(function(){

  var $W = $(window);
  var firstTime = true;
  function loop(){

      var scrolled = $W.scrollTop(),
          maxScroll = $(document).height() - $W.height();
      if(scrolled >= maxScroll) {
        $W.scrollTop(0);
        if(firstTime) {
          $('.content').css('paddingTop','60%');
          firstTime = false;
        }
      }

  }
  
  $W.scroll(loop).resize(loop);
  loop();
})