I am trying to use the progress option for the fadeOut animation in jquery. I have no idea how to properly implement it though. One of the versions I tried based on this answer is:
$(window).on("load", function() {
var timer = 1000;
$(".loader-wrapper").fadeOut(timer, progress)
function progress(progress, progressNb, remaining) {
console.log(progressNb)
}
});
But I get undefined in the console.
Most of the other answers I found were about starting something after the fadeout animation (example), but this is not what I want.
CodePudding user response:
Your current fadeOut
function call uses the .fadeOut( [duration ] [, complete ] )
signature that accepts only duration and complete callback function. But as you need more options you must use the .fadeOut( options )
signature as follows in order to configure/play with the different options:
$(window).on("load", function() {
var timer = 1000;
$(".loader-wrapper").fadeOut({duration: timer, progress: progress})
function progress(progress, progressNb, remaining) {
console.log(progressNb)
}
});