You could keep a running count of how many li's have called fadeOut
and store it with .data(). Here's an example storing it on the parent
ul:

$("#menu ul li a").click(function(e) {
        e.preventDefault();
        var li = $(this).parent().siblings();
        li.fadeOut(function() {
                var licount = $(this).closest('ul');
                
licount.data('count',(licount.data('count')?(licount.data('count')
+1):1));
                if(licount.data('count') == li.length){
                        $("p").append("Executed. ");
                }
        });
});

On Apr 19, 3:01 pm, blockedmind <blockedm...@gmail.com> wrote:
> Thanks for the reply firstly. :) Since I'm talking about a default
> jQuery function I didn't give a full example. If you think that I'd
> help let me give you one.
>
> I have simplified my code for the example, here it 
> goes:http://blockedmind.com/jq/fadeout.html
>
> When you click a link, the others are disappearing and a message is
> added to the testing paragraf. I want to get "Executed" text added
> once. But it is added as many as the count of siblings due to default
> options of fadeOut callback function.
>
> And no, I can not put it elsewhere because I have more effects after
> click in my real situation and I need to get that message after all of
> them completed and for once of course.
>
> I hope I am clear?
>
> On Apr 19, 4:44 pm, Karl Swedberg <k...@englishrules.com> wrote:
>
> > Would you mind giving us some code to look at? Or point us to a test  
> > page? It might be easier to help you if we have something to look at.
>
> > --Karl
>
> > ____________
> > Karl Swedbergwww.englishrules.comwww.learningjquery.com
>
> > On Apr 19, 2009, at 7:22 AM, blockedmind wrote:
>
> > > Hmmm...
>
> > > On Apr 18, 2:28 am, blockedmind <blockedm...@gmail.com> wrote:
> > >> Nothing?
>
> > >> On Apr 17, 8:46 pm, blockedmind <blockedm...@gmail.com> wrote:
>
> > >>> This problem occurs when $("#menu li a").fadeOut(function() {});  
> > >>> being
> > >>> used. callback function is called 3 times 'cos there is 3 li  
> > >>> elements.
>
> > >>> On Apr 17, 7:28 pm, blockedmind <blockedm...@gmail.com> wrote:
>
> > >>>> Callback function of fadeOut effect is executed once for each  
> > >>>> element
> > >>>> animated against. Is it possible to make it executed once after all
> > >>>> elements faded?

Reply via email to