-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscripts.js
185 lines (132 loc) · 4.18 KB
/
scripts.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
$( document ).ready(function() {
// Progress bar
// let containerA = document.getElementById("circleA");
// let circleA = new ProgressBar.Circle(containerA, {
// color: '#65DAF9',
// strokeWidth: 8,
// duration: 1400,
// from: { color: '#aaa'},
// to: { color: '#65DAF9'},
// step: function(state, circle) {
// circle.path.setAttribute('stroke', state.color);
// var value = Math.round(circle.value() * 60);
// circle.setText(value);
// }
// });
// let containerB = document.getElementById("circleB");
// let circleB = new ProgressBar.Circle(containerB, {
// color: '#65DAF9',
// strokeWidth: 8,
// duration: 1600,
// from: { color: '#aaa'},
// to: { color: '#65DAF9'},
// step: function(state, circle) {
// circle.path.setAttribute('stroke', state.color);
// var value = Math.round(circle.value() * 254);
// circle.setText(value);
// }
// });
// let containerC = document.getElementById("circleC");
// let circleC = new ProgressBar.Circle(containerC, {
// color: '#65DAF9',
// strokeWidth: 8,
// duration: 1800,
// from: { color: '#aaa'},
// to: { color: '#65DAF9'},
// step: function(state, circle) {
// circle.path.setAttribute('stroke', state.color);
// var value = Math.round(circle.value() * 32);
// circle.setText(value);
// }
// });
// let containerD = document.getElementById("circleD");
// let circleD = new ProgressBar.Circle(containerD, {
// color: '#65DAF9',
// strokeWidth: 8,
// duration: 2000,
// from: { color: '#aaa'},
// to: { color: '#65DAF9'},
// step: function(state, circle) {
// circle.path.setAttribute('stroke', state.color);
// var value = Math.round(circle.value() * 5423);
// circle.setText(value);
// }
// });
// iniciando loaders quando a usuário chegar no elemento
let dataAreaOffset = $('#data-area').offset();
// stop serve para a animação não carregar mais que uma vez
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
// setTimeout serve para carregar primeiro as imagens
setTimeout(function() {
$('#data-area').parallax({imageSrc: 'img/cidadeparallax.png'});
$('#apply-area').parallax({imageSrc: 'img/pattern.png'});
}, 200);
// Filtro portfólio
$('.filter-btn').on('click', function() {
let type = $(this).attr('id');
let boxes = $('.project-box');
$('.main-btn').removeClass('active');
$(this).addClass('active');
if(type == 'dsg-btn') {
eachBoxes('dsg', boxes);
} else if(type == 'dev-btn') {
eachBoxes('dev', boxes);
} else if(type == 'seo-btn') {
eachBoxes('seo', boxes);
} else {
eachBoxes('all', boxes);
}
});
function eachBoxes(type, boxes) {
if(type == 'all') {
$(boxes).fadeIn();
} else {
$(boxes).each(function() {
if(!$(this).hasClass(type)) {
$(this).fadeOut('slow');
} else {
$(this).fadeIn();
}
});
}
}
// scroll para as seções
let navBtn = $('.nav-item');
let bannerSection = $('#mainSlider');
let aboutSection = $('#about-area');
let servicesSection = $('#services-area');
let teamSection = $('#team-area');
let portfolioSection = $('#portfolio-area');
let contactSection = $('#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 = teamSection;
} else if(btnId == 'portfolio-menu') {
scrollTo = portfolioSection;
} else if(btnId == 'contact-menu') {
scrollTo = contactSection;
} else {
scrollTo = bannerSection;
}
$([document.documentElement, document.body]).animate({
scrollTop: $(scrollTo).offset().top - 70
}, 1500);
});
});