I don't know if it is suppoused to do this, but I guess it is...
I thought at first that it may be something wrong with my whole script and I managed to make new file on localhost and test just fadeOut();
function.
Apparently it returned function twice again so I went to jsfiddle to check what will happen there. And same thing happened. In this case console.log();
returned twice.
- What I did and what I am trying to do ?
Well I want to return specified function, or in fiddle sample, specified console.log();
only once. However I am fadingOut multiple elements (two, to be exact).
Is there any way to do that, instead of duplicating each element to fadeOut at the same time ?
Sample that will return console.log(); twice.
setTimeout(function () {
$( ".one, .two" ).fadeOut(300, function () {
console.log("Return Function!");
});
}, 2000);
Sample that will return console.log(); once.
setTimeout(function () {
$( ".one" ).fadeOut(300);
$( ".two" ).fadeOut(300, function () {
console.log("Return Function!");
});
}, 2000);
Fiddle Preview: Fiddle Redirect