Skip to content

Commit

Permalink
FIX: scroll percent now count only content div.
Browse files Browse the repository at this point in the history
  • Loading branch information
ivan-nginx authored Apr 7, 2017
1 parent 2eee68f commit 4bd315d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions source/js/src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,13 @@ NexT.utils = NexT.$u = {
$top.toggleClass('back-to-top-on', window.pageYOffset > THRESHOLD);

var scrollTop = $(window).scrollTop();
var docHeight = $(document).height();
var docHeight = $('#content').height();
var winHeight = $(window).height();
var scrollPercent = (scrollTop) / (docHeight - winHeight);
var scrollPercentRounded = Math.round(scrollPercent*100);
$('#scrollpercent>span').html(scrollPercentRounded);
var scrollPercentMaxed = (scrollPercentRounded > 100) ? 100 : scrollPercentRounded;
$('#scrollpercent>span').html(scrollPercentMaxed);
});
});

$top.on('click', function () {
Expand Down

0 comments on commit 4bd315d

Please sign in to comment.