Skip to content

Instantly share code, notes, and snippets.

@bilalmalkoc
Created August 31, 2019 12:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bilalmalkoc/8d544a291259bb6f3ba9bc7c478f6ed0 to your computer and use it in GitHub Desktop.
Save bilalmalkoc/8d544a291259bb6f3ba9bc7c478f6ed0 to your computer and use it in GitHub Desktop.
$(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