Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Progress Bar Progress

I am trying to figure out how to tie a progress bar's progress to the loading of the page. For example, when it's at 100% is what the page is fully loaded.

In the past, I've had a progress bar and just removed it with .load but it wasn't tied to the page's loading percentage. - like so

$(window).load(function() { // makes sure the whole site is loaded
    $("#status").addClass('animated, bounceOutRight'); // will first fade out the loading animation
    $("#preloader").addClass('animated, bounceOutRight'); // will fade out the DIV that covers the website.
});

I like this plugin and wanted to use it - http://ricostacruz.com/nprogress/ but tie it in to the actual page load.

Any help would be greatly appreciated.

2 Answers

I think nprogress fakes it, that's why hubspot made pace which monitors AJAX requests.

James Barnett - I saw that they advertise that they fake it, but how do you tie Pace to the load time as well? I've seen this plugin before, but couldn't figure out how to do it with it either.