-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathscript.js
188 lines (122 loc) · 3.92 KB
/
script.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
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
/*O SCRIPT FOI PASSADO PARA A PAGINA INDEX POIS O PHP CRIA ALGUM CONFLITO AO IMPORTAR ALGUM ARQUIVO JS EXTERNO*/
$(document).ready(function() {
//BarraDeProgresso
let containerA = document.getElementById("circleA");
let circleA = new ProgressBar.Circle(containerA, {
color: '#ae55f2',
strokeWidth: 6,
duration: 1400,
from: {
color: '#AAA'
},
to: {
color: '#ae55f2'
},
step: function(state, circle) {
circle.path.setAttribute('stroke', state.color);
let value = Math.round(circle.value() * 97);
circle.setText(value);
}
});
let containerB = document.getElementById("circleB");
let circleB = new ProgressBar.Circle(containerB, {
color: '#ae55f2',
strokeWidth: 6,
duration: 1600,
from: {
color: '#AAA'
},
to: {
color: '#ae55f2'
},
step: function(state, circle) {
circle.path.setAttribute('stroke', state.color);
let value = Math.round(circle.value() * 16);
circle.setText(value);
}
});
let containerC = document.getElementById("circleC");
let circleC = new ProgressBar.Circle(containerC, {
color: '#ae55f2',
strokeWidth: 6,
duration: 1800,
from: {
color: '#AAA'
},
to: {
color: '#ae55f2'
},
step: function(state, circle) {
circle.path.setAttribute('stroke', state.color);
let value = Math.round(circle.value() * 35);
circle.setText(value);
}
});
let containerD = document.getElementById("circleD");
let circleD = new ProgressBar.Circle(containerD, {
color: '#ae55f2',
strokeWidth: 6,
duration: 2000,
from: {
color: '#AAA'
},
to: {
color: '#ae55f2'
},
step: function(state, circle) {
circle.path.setAttribute('stroke', state.color);
let value = Math.round(circle.value() * 46);
circle.setText(value);
}
});
//animando só quando o usuário chegar em determinada parte do site
let dataAreaOffset = $('#data-area').offset();
let stop = 0;
$(window).scroll(function(e) {
let scroll = $(window).scrollTop();
if (scroll > (dataAreaOffset.top - 500) && stop == 0) {
circleA.animate(1.0);
circleB.animate(1.0);
circleC.animate(1.0);
circleD.animate(1.0);
stop = 1;
}
});
//Parallax(imagem ao fundo estatica)
setTimeout(function() {
$('#data-area').parallax({
imageSrc: 'img/parallax.jpg'
});
$('#pattern-img').parallax({
imageSrc: 'img/assedio-onibus-pessoas.jpeg'
});
}, 250);
let navBtn = $('.nav-item');
let bannerSection = $('#mainSlider');
let aboutSection = $('#about-area');
let servicesSection = $('#services-area');
let timeSection = $('#time-area');
let denunciaSection = $('#apply-area');
let contatoSection = $('#contact-area');
let scrollTo = '';
$(navBtn).click(function() {
let btnId = $(this).attr('id')
if (btnId == 'about-menu') {
scrollTo = aboutSection;
} else if (btnId == 'services-menu') {
scrollTo = servicesSection;
} else if (btnId == 'team-menu') {
scrollTo = timeSection;
} else if (btnId == 'denuncia-menu') {
scrollTo = denunciaSection;
} else if (btnId == 'contato-menu') {
scrollTo = contatoSection;
} else {
scrollTo = bannerSection
}
$([document.documentElement, document.body])
.animate({
scrollTop: $(scrollTo).offset().top - 70
}, 1000);
});
});