tags:

views:

30

answers:

1

In my app, I have a temporary div that is shown each time the app is saved (see markup below). I'm using jQuery 1.4.2 and would like to know the command that will fade this div off the screen after 3 seconds...

<script src="../wp-content/themes/mytheme/jquery-1.4.2.min.js" type="text/javascript"></script>
if ($_REQUEST['saved']) echo '<div id="message" class="updated fade"><p>'.$themename.' settings saved.</strong></p></div>';
+3  A: 

jQuery's fadeOut() should do the job.

http://api.jquery.com/fadeOut/

$('#message').delay(3000).fadeOut();
Andy Shellam
you need to chain it with delay() though: '... after 3 seconds.'
Ed Woodcock
@Ed thanks was just editing my answer to add that in!!
Andy Shellam
Sweet! $('#message').delay(3000).fadeOut(3000);
Scott B
@Scott the 3000 in fadeOut will make the animation fade out over 3 seconds - the 3000 delay makes the message stay on screen for 3 seconds before animating out. This might be what you want but just pointing it out ;-)
Andy Shellam