rstacruz / nprogress

For slim progress bars like on YouTube, Medium, etc
http://ricostacruz.com/nprogress
MIT License
26.15k stars 1.82k forks source link

Build in imageLoaded.js #203

Closed liammday closed 2 years ago

liammday commented 6 years ago

I've found it useful to incorporate imageLoaded.js to the NProgress.done(); function. Could this be built in to the core script rather than the end user having to combine the 2 scripts?

hubseven commented 6 years ago

@liammday try this

`` NProgress.start(); $(document).ready(function() {

$('body')
    .imagesLoaded({ background: true })
    .always(function() { NProgress.done(); })
    .progress(function() { NProgress.inc(); });

    $('#container')
        .imagesLoaded({ background: true })
        .progress(function() { NProgress.inc(); })
        .always(function() {
            NProgress.done();
        });

});