views:

22

answers:

1

I need to run a function 'setNotifications()' after a timed delay or at the end of completion of the previous animation('#topannounce' animation).But jQuery is not running the 'setNotifications()'after the animation. What should I do? or is there a better way to run the function?Plz hlp.Thanx.

Here is the jQuery I have.

$('a#resetbtn').bind('click', function(){
    //setNotifications();
    $.cookie('notificationBar', 'open');
    //$('#topannounce').animate({opacity: 1.0}, 3000).fadeIn('slow');
    $('#topannounce').fadeIn('slow');
    setNotifications();

  });

function setNotifications() {
    alert("load:setNotifications...");
}
+1  A: 

Actually there is no real error in your code, it should work and you should see a messagebox alerting, but that should happen instantly when you click the anchor.

If you want the alert to appear AFTER the fadeIn, use the callback, like:

$('a#resetbtn').bind('click', function(){
   //setNotifications();
   $.cookie('notificationBar', 'open');
   //$('#topannounce').animate({opacity: 1.0}, 3000).fadeIn('slow');
   $('#topannounce').fadeIn('slow', setNotifications);
 });

function setNotifications() {
   alert("load:setNotifications...");
}
jAndy
Thank u so much.It worked perfectly!!!
Maju