UPDATE: Based on your comments...
First question:
You should probably look at some of the blockUI demos.
It looks like blockUI has a callback onBlock: that calls a function after the fadeIn is done.
onBlock: function() {
alert('Page is now blocked; fadeIn complete');
}
Second question:
jQuery is just a library of javascript code, therefore you can assign functions to variables the same way you always do.
var a = function dosome() {
// do something
};
a(); // call the function
Third question:
You mean you want to redirect after the 3000ms fadeIn of the blockUI? You would do it in the callback that I pointed out under question 1 above. But of course this will make the entire page change, including the blockUI.
window.location = "http://somedomain.com/some/path";
Some clarification in your question is needed.
It sounds like you have a function that sets a setTimeout() for some purpose, and that function is reused, so you need to reference the correct instance of setTimeout().
If so, you can have your function return the setTimeout() instance, and use that reference to clear it if needed.
function unblockUI(dur) {
return setTimeout(function() {
$.unblockUI();
}, dur);
}
var someTimeout = unblockUI(1000);
clear(someTimeout);
var someOtherTimeout = unblockUI(1000);
clear(someOtherTimeout);
Is this close to what you're asking?