Reputation: 6519
I love this plugin: http://jquery.malsup.com/block/#demos
The iPhoto (ish) one works beautifully on my site so far. I click a button, the block appears and the new page loads.
However, I'd like to set the setTimeout value to be when the next page has completed loading. So once the page fully loads, the block disappears.
How do I achieve this?
Thank you
Upvotes: 0
Views: 1217
Reputation: 3975
I don't know how you are loading the pages but if you can send a function when the page does load, do something like this:
function page_loaded(){
$.blockUI({
message: 'page loaded!'
});
}
Upvotes: 1
Reputation: 2726
I think you must be using ajax to reload the content.
You could do:
$('#TheLastElementThatYouReload').ready(function () {
// set timeout / hide block
});
I'm unsure why you need a timeout, but this way you won't need it.
Upvotes: 1
Reputation: 1028
If you load the new page via ajax, in this page:
http://jquery.malsup.com/block/#overview
there is this:
$(document).ajaxStart($.blockUI).ajaxStop($.unblockUI);
which sort of binds itself to every ajax load. I guess instead of setTimeout you should put an event to the end of loading a page since setTimeout works only with time and "guessing" a page's loading time does not make much sense
Hope this helps
Upvotes: 1