fade in div when user scrolls down page?
<p>I am trying to get a div to fade in using javascript when a user scolls down the page, the problem i am having is although it fades in it is fading in and fading out multiple times very quickly like its pulsating.</p>

<p>i only want it so that the div fades in slowly once when the user scrolls down the page. can someone please help?</p>

<pre><code>&lt;script&gt;
   $(window).scroll(function(){
       var leftToBottom = $(document).height() - $(window).height() - $(window).scrollTop();
       var distanceFromTop = $(window).scrollTop();
       if( distanceFromTop &gt; 600 &amp;&amp; !$("profile_intro_case5").is(":visible") 
          &amp;&amp; leftToBottom &gt; 600) {
            $(".profile_intro_case5").fadeIn();
       }else if($(".profile_intro_case5").is(":visible") &amp;&amp; (distanceFromTop &lt; 600 || leftToBottom &lt; 600)){
            $(".profile_intro_case5").fadeOut();
      }
   });
&lt;/script&gt;
</code></pre>
