-
Notifications
You must be signed in to change notification settings - Fork 0
/
sesss.js
109 lines (87 loc) · 2.72 KB
/
sesss.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
function showContent(contentId) {
var icerikler = document.getElementsByClassName("icerik");
for (var i = 0; i < icerikler.length; i++) {
icerikler[i].style.display = "none";
}
var seciliIcerik = document.getElementById(contentId);
seciliIcerik.style.display = "block";
}
var nav = $('nav');
var line = $('<div />').addClass('line');
line.appendTo(nav);
var active = nav.find('.active');
var pos = 0;
var wid = 0;
if(active.length) {
pos = active.position().left;
wid = active.width();
line.css({
left: pos,
width: wid
});
}
nav.find('ul li a').click(function(e) {
e.preventDefault();
if(!$(this).parent().hasClass('active') && !nav.hasClass('animate')) {
nav.addClass('animate');
var _this = $(this);
nav.find('ul li').removeClass('active');
var position = _this.parent().position();
var width = _this.parent().width();
if(position.left >= pos) {
line.animate({
width: ((position.left - pos) + width)
}, 300, function() {
line.animate({
width: width,
left: position.left
}, 150, function() {
nav.removeClass('animate');
});
_this.parent().addClass('active');
});
} else {
line.animate({
left: position.left,
width: ((pos - position.left) + wid)
}, 300, function() {
line.animate({
width: width
}, 150, function() {
nav.removeClass('animate');
});
_this.parent().addClass('active');
});
}
pos = position.left;
wid = width;
}
});
function showContent(contentId) {
var icerikler = document.getElementsByClassName("icerik");
for (var i = 0; i < icerikler.length; i++) {
icerikler[i].style.display = "none";
}
var seciliIcerik = document.getElementById(contentId);
seciliIcerik.style.display = "block";
}
let calcScrollValue = () => {
let scrollProgress = document.getElementById("progress");
let progressValue = document.getElementById("progress-value");
let pos = document.documentElement.scrollTop;
let calcHeight =
document.documentElement.scrollHeight -
document.documentElement.clientHeight;
let scrollValue = Math.round((pos * 100) / calcHeight);
if (pos > 1200) {
scrollProgress.style.display = "grid";
} else {
scrollProgress.style.display = "none";
}
scrollProgress.addEventListener("click", () => {
document.documentElement.scrollTop = 900;
});
scrollProgress.style.background = `conic-gradient(#A91101 ${scrollValue}%, #FFFFFF ${scrollValue}%)`;
};
window.onscroll = calcScrollValue;
window.onload = calcScrollValue;