Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing jQuery BlockUI plugin upon page navigation (unload event)
    primarykey
    data
    text
    <p><a href="http://www.malsup.com/jquery/block/#options" rel="nofollow">jQuery BlockUI</a> plugin has a very cool feature of attaching itself to every AJAX call with simple code:</p> <pre><code>$(document).ajaxStart($.blockUI).ajaxStop($.unblockUI); </code></pre> <p>Can I use similar approach to display blockUI overlay on each navigation, like clicking any link etc.?</p> <p>I think, this should be done using <code>unload</code> event, but I failed with this.</p> <pre><code>$(window).on('unload', function() { $.blockUI; }); </code></pre> <p>Upon navigation blockUI overlay does not appears (I don't care about hiding it, because new loaded page won't have it).</p> <p>I can even:</p> <pre><code>$(window).on('unload', function() { console.log('$.blockUI;'); $.blockUI; console.log('Bye!'); }); </code></pre> <p>and I clearly see both <code>$.blockUI;</code> and <code>Bye!</code> messages in console, but no sign of blockUI overlay.</p> <p>I've read that many browsers blocks displaying <code>alert()</code>'s in <code>unload</code>. Does it also covers blockUI? It shouldn't as it is just a bunch of divs or other DOM elements plus some styling?</p> <p>Tested in Chrome 27, Internet Explorer 10 and Firefox 21. What am I missing or doing wrong?</p> <p>Two or three years ago, in an old project, I manage to achieve above mentioned functionality, but it was done there purely by biding blockUI showup to particular buttons and menu items. I would like to avoid this as much as possible and make it globally, just as with AJAX calls.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload