Detectar quando o Body Scroll atinge o topo | parte inferior do elemento

Estou tentando detectar o uso de javascript e jquery quando a janela de rolagem atinge a parte superior de um elemento selecionado. Acho que estou fazendo progresso, mas ainda não obtive resultados:

violino:https://jsfiddle.net/jzhang172/opvb2csy/

$(window).scroll(function() {
    var targetScroll = $('.div').position().top;
    if($(window).scrollTop() > targetScroll){
        alert('hey');
    });
});
body,html{
  height:2000px;
}
.div{
  height:300px;
  width:300px;
  position:absolute;
  top:500px;
  background:red;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<div class="div"></div>

questionAnswers(2)

yourAnswerToTheQuestion