Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
$(document).ready(function () {
var winHeight = $(window).height(),
docHeight = $(document).height(),
progressBar = $('.wpuprogress'),
max, value;
max = docHeight - winHeight;
$(document).on('scroll', function(){
value = $(window).scrollTop();
progressBar.css('width', value / max * 100 + '%' );
});
$(window).on('resize', function() {
winHeight = $(window).height();
docHeight = $(document).height();
max = docHeight - winHeight;
progressBar.css('width', value / max * 100 + '%');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.