1
(function ($) {
2
"use strict";
3
4
jQuery(window).on('load', function () {
5
6
var progressPath = document.querySelector('.progress-wrap path');
7
var pathLength = progressPath.getTotalLength();
8
9
progressPath.style.transition = progressPath.style.WebkitTransition = 'none';
10
progressPath.style.strokeDasharray = pathLength + ' ' + pathLength;
11
progressPath.style.strokeDashoffset = pathLength;
12
progressPath.getBoundingClientRect();
13
progressPath.style.transition = progressPath.style.WebkitTransition = 'stroke-dashoffset 10ms linear';
14
15
var updateProgress = function () {
16
var scroll = jQuery(window).scrollTop();
17
var height = jQuery(document).height() - jQuery(window).height();
18
var progress = pathLength - (scroll * pathLength / height);
19
progressPath.style.strokeDashoffset = progress;
20
};
21
22
updateProgress();
23
24
jQuery(window).scroll(updateProgress);
25
26
});
27
28
})(jQuery);