run javascript on div click?

Im An Angel

New Member
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.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 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 \[code\]<script>$('div.exit_intro4').click(function(){ $(window).scroll(function(){ var leftToBottom = $(document).height() - $(window).height() - $(window).scrollTop(); var distanceFromTop = $(window).scrollTop(); if( distanceFromTop > 300 && !$("profile_intro_case5").is(":visible") && leftToBottom > 1000 && !$(".profile_intro_case5").is(":animated")) { $(".profile_intro_case5").fadeIn(1000); }else if($(".profile_intro_case5").is(":visible") && (distanceFromTop < 300 || leftToBottom < 1000) && !$(".profile_intro_case5").is(":animated")){ $(".profile_intro_case5").fadeOut(); } });}); </script>\[/code\]original:\[code\]<script> $(window).scroll(function(){ var leftToBottom = $(document).height() - $(window).height() - $(window).scrollTop(); var distanceFromTop = $(window).scrollTop(); if( distanceFromTop > 300 && !$("profile_intro_case5").is(":visible") && leftToBottom > 1000 && !$(".profile_intro_case5").is(":animated")) { $(".profile_intro_case5").fadeIn(1000); }else if($(".profile_intro_case5").is(":visible") && (distanceFromTop < 300 || leftToBottom < 1000) && !$(".profile_intro_case5").is(":animated")){ $(".profile_intro_case5").fadeOut(); } }); </script>\[/code\]
 
Top