You could do something like this:
$(document).ready(function() {
$("#menu ul li a").click(function(e) {
e.preventDefault();
var $sibs = $(this).parent().siblings();
$sibs.fadeOut(function() {
if ( $sibs.index(this) == $sibs.length-1 ) {
$("p").append("Executed. ");
}
});
});
$("p").append("Page loaded. ");
});
This will only append "Executed." for the last sibling in the group.
($sibs.index(this) == $sibs.length-1).
--Karl
____________
Karl Swedberg
www.englishrules.com
www.learningjquery.com
On Apr 19, 2009, at 6:01 PM, blockedmind 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?