malsup / blockui

jQuery BlockUI Plugin
http://jquery.malsup.com/block/
1.69k stars 506 forks source link

Add a fade in delay #80

Open rottmann opened 11 years ago

rottmann commented 11 years ago

For an application, that communicate with a server, i use blockUI when a request start and unblockUI when the request finish.

Many times the response arrive quick (less then 200 ms), in that case the blockUI flash a short time, that looks not so good (increasing fadeIn time is not the solution).

A delay for displaying could defuse the problem, e. g. i modify the code a little bit: (line 418)

            if ((msie || opts.forceIframe) && opts.showOverlay)
                lyr1.show(); // opacity is zero
            if (opts.fadeIn) {
                var cb = opts.onBlock ? opts.onBlock : noOp;
                var cb1 = (opts.showOverlay && !msg) ? cb : noOp;
                var cb2 = msg ? cb : noOp;
// MOD: start
this.timer = setTimeout(function() {
                    if (opts.showOverlay)
                        lyr2._fadeIn(opts.fadeIn, cb1);
                    if (msg)
                        lyr3._fadeIn(opts.fadeIn, cb2);
}, opts.fadeInDelay);
// MOD: end
            }

and on unblockUI clear the timer.

VsevolodGolovanov commented 9 years ago

Or support specifying jQuery's easing functions.

pablocar80 commented 4 years ago

if anyone needs this functionality, I added it to my copy of BlockUI in one of my projects. The source is here.