When I try NProgress.js, as the document said, when document load start it, and when window loaded stop it. But I found it the scenario was reverse; If NProgress.done before starts, the progress will never end.
if (typeof NProgress != 'undefined') {
$(document).ready(function () {
NProgress.done();
console.log( "document loaded" );
});
$(window).on("load", function() {
console.log( "window loaded" );
NProgress.start();
});
};
The console log above will show "window loaded" before "document loaded". I have swapped the above code to make it works. Any idea?
I suppose I post a misleading question. I do understood the .ready and .load events. Actually I am applying NProgress.js to my web page, I noticed that the progress never finish loading[due to the .done() called prior to .start().] So I "experiment" those 2 events, and found that those 2 events do not follows accordingly. Now, my code above works. But does not follow documented convention, thus I seek for opinions.