[jQuery] blockUI timer?

[jQuery] blockUI timer?


I'd like to block some elements using blockUI when ajax is executed,
but only if the request takes longer than one second. What's the best
way to do this? Here's my fairly trivial code so far.
var activeElem = null;
$().ajaxStart(
            function() {
                if (activeElem) {
                    $(activeElem).block();
                }
            }
        ).ajaxStop(
            function() {
                if (activeElem) {
                    $(activeElem).unblock();
                    activeElem= null;
                }
            }
        );
activeElem is set in my code as the element to block when the next
ajax call is made...