run javascript on div click?
<p>i wonder if someone can help, basically i have this javascript which fades in a div when the user scrolls down a page, however, i want to put a condition on the javascript to say only fade after the user has clicked another div element.</p>

<p>for instance i need the user to read a piece of text before they scroll down the page and this div fades in, on this piece of text is a div called </p>

<p>so once the user has read the text they will click 'exit_profile_intro4' which will close the text box,
only then do i want the javascript for the scroll and fade in div to work. can someone please show me how i can do this: i've tried </p>

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

<p>original:</p>

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