I have this javascript:
triggerAnimation(listItem,toggleToggleRadioListItem(listItem));
function triggerAnimation(listItem,passThruFunction){
listItem.find(".inlineLoading").show();
$("body").animate({opacity: 1}, 1000,
function(){
alert("a");
passThruFunction;
}
);
}
function toggleToggleRadioListItem(listItem) {
alert("b");
};
What is going to happen:
- triggerAnimation is called passing an object and function
- triggerAnimation makes a dummy animation (to pause it), then triggers a warning and launches a callback function that executes the passed function.
- the function that was passed is called raising the alert.
Based on the foregoing, I expect warning A to appear before signal B, but this is not the case. It happens that (it seems) warning B is triggered as soon as triggerAnimation () is called. Why is this? How can I achieve this behavior?
source
share