How do I use the JQuery delay in conjunction with my own defined function, pseudo-code like so?:
$('#foo').slideUp(300).delay(800).myOwnFunction(1,2,3);
function myOwnFunction (a,b,c) {...}
The code above doesn’t work, however – per the JQuery documentation it appears like it should.
Use
setTimeout()here. After the animation has finished sliding up, it will run the anonymous function that wraps thesetTimeout()which calls your function after approx 800 milliseconds.It doesn’t matter that this was defined below as it’s definition should be hoisted to the top.