-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
144 lines (117 loc) · 3.92 KB
/
Copy pathscript.js
File metadata and controls
144 lines (117 loc) · 3.92 KB
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
// htmlcss progress circular bar
let htmlProgress = document.querySelector(".html-css"),
htmlValue = document.querySelector(".html-progress");
let htmlStartValue = 0,
htmlEndValue = 90,
htmlspeed = 30;
let progresshtml = setInterval(() => {
htmlStartValue++;
htmlValue.textContent = `${htmlStartValue}%`;
htmlProgress.style.background = `conic-gradient(#fca61f ${
htmlStartValue * 3.6
}deg, #ededed 0deg)`;
if (htmlStartValue == htmlEndValue) {
clearInterval(progresshtml);
}
}, htmlspeed);
// javasript progress circular bar
let javascriptProgress = document.querySelector(".javascript"),
javascriptValue = document.querySelector(".javascript-progress");
let javascriptStartValue = 0,
javascriptEndValue = 75,
jsspeed = 30;
let progressjs = setInterval(() => {
javascriptStartValue++;
javascriptValue.textContent = `${javascriptStartValue}%`;
javascriptProgress.style.background = `conic-gradient(#7d2ae8 ${
javascriptStartValue * 3.6
}deg, #ededed 0deg)`;
if (javascriptStartValue == javascriptEndValue) {
clearInterval(progressjs);
}
}, jsspeed);
// php progress circular bar
let phpProgress = document.querySelector(".php"),
phpValue = document.querySelector(".php-progress");
let phpStartValue = 0,
phpEndValue = 80,
phpspeed = 30;
let progressphp = setInterval(() => {
phpStartValue++;
phpValue.textContent = `${phpStartValue}%`;
phpProgress.style.background = `conic-gradient(#20c997 ${
phpStartValue * 3.6
}deg, #ededed 0deg)`;
if (phpStartValue == phpEndValue) {
clearInterval(progressphp);
}
}, phpspeed);
// reactjs progress circular bar
let reactProgress = document.querySelector(".reactjs"),
reactValue = document.querySelector(".reactjs-progress");
let reactStartValue = 0,
reactEndValue = 30,
rjsspeed = 30;
let progressreact = setInterval(() => {
reactStartValue++;
reactValue.textContent = `${reactStartValue}%`;
reactProgress.style.background = `conic-gradient(#3f396d ${
reactStartValue * 3.6
}deg, #ededed 0deg)`;
if (reactStartValue == reactEndValue) {
clearInterval(progressreact);
}
}, rjsspeed);
// filter using javascript
$(document).ready(function () {
$(".filter-item").click(function () {
const value = $(this).attr("data-filter");
if (value == "all") {
$(".post").show("1000");
} else {
$(".post")
.not("." + value)
.hide("1000");
$(".post")
.filter("." + value)
.show("1000");
}
});
});
// javascript for sticky navbar even if u scroll the navbar will be fixed
document.addEventListener("DOMContentLoaded", function(){
window.addEventListener('scroll', function() {
if (window.scrollY > 50) {
document.getElementById('navbar-top').classList.add('fixed-top');
// add padding top to show content behind navbar
navbar_height = document.querySelector('.navbar').offsetHeight;
document.body.style.paddingTop = navbar_height + 'px';
} else {
document.getElementById('navbar-top').classList.remove('fixed-top');
// remove padding top from body
document.body.style.paddingTop = '0';
}
});
});
// adding funtionality to back to top button
//Get the button
let mybutton = document.getElementById("btn-back-to-top");
// When the user scrolls down 20px from the top of the document, show the button
window.onscroll = function () {
scrollFunction();
};
function scrollFunction() {
if (
document.body.scrollTop > 20 ||
document.documentElement.scrollTop > 20
) {
mybutton.style.display = "block";
} else {
mybutton.style.display = "none";
}
}
// When the user clicks on the button, scroll to the top of the document
mybutton.addEventListener("click",function(){
document.body.scrollTop = 0;
document.documentElement.scrollTop = 0;
});