Offset top does not return the expected value
<pre><code>$(window).scroll(function(e){
    if($(this).scrollTop()&gt;=400)    $('#jtop').show('slow');
    if($(this).scrollTop()&lt;400) if($('#jtop').width()) $('#jtop').hide('slow');
});
</code></pre>

<p>I'm using the function to determine if someone scrolls down over 400 an toggling an image and it's working fine but when I try to get notified if someone reaches my footer's top position it doesn't return the expected value. I used offset().top but it alerts me when I scroll down to bottom 0. I just want to know when user is entering and leaving my footer. Hope someone will help me. Thanks in advance.
If you want to see it in action then here is the link <a href="http://heera.it" rel="nofollow">heera.it</a></p>

<p>Non working code</p>

<pre><code>    var ftop=$('#footer').offset().top;
    $(window).scroll(function(e){
        if($(this).scrollTop()&gt;=400)
        {
            $('#jtop').show('slow');
        }
        if($(this).scrollTop()&lt;400)
        {
            if($('#jtop').width()) $('#jtop').hide('slow');
        }
        if($(this).scrollTop()&gt;=ftop)   console.log('true');
        if($(this).scrollTop()&lt;ftop)    console.log('false');
    });
</code></pre>
