Having troubles having an animation change on click

Having troubles having an animation change on click

Hey, still fairly new to jquery (and javascript in general), and I could use some advice on a (presumably) basic function I've been trying to write.

The page runs a basic slideUp / fadeOut > slideUp / fadeIn animation on a delay, but I want the user to be able to skip all of that by clicking on the image (or pretty much wherever, I'm not picky at this point). The code I have so far is:

  1. $(document).ready(function(){
  2. $('#wrapper').click(function(){
  3. $('#wrapper').data('clicked', true);
  4. alert('this is an alert');
  5. });
  6. if($('#wrapper').data('clicked')){
  7. $('#imagepos').slideUp(500).fadeOut(500);
  8. $('#contentpos').slideUp(500).fadeIn(500);
  9. } else {
  10. $('#imagepos').delay(8000).slideUp(2000).fadeOut(2000);
  11. $('#contentpos').delay(8000).slideUp(2000).fadeIn(5000);
  12. }
  13. });