-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
61 lines (45 loc) · 1.27 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
$(document).ready(function(){
$('#menu').click(function(){
$(this).toggleClass('fa-times');
$('.navbar').toggleClass('nav-toggle');
});
$(window).on('scroll load',function(){
$('#menu').removeClass('fa-times');
$('.navbar').removeClass('nav-toggle');
});
$('.portfolio .button-container .btn').click(function(){
let filter = $(this).attr('data-filter');
if(filter == 'all'){
$('.portfolio .image-container .box').show('400')
}
});
$('#theme-toggler').click(function(){
$(this).toggleClass('fa-sun');
$('body').toggleClass('dark-theme');
});
// smooth scrolling
$('a[href*="#"]').on('click',function(e){
e.preventDefault();
$('html, body').animate({
scrollTop : $($(this).attr('href')).offset().top,
},
500,
'linear'
);
});
});
window.addEventListener('scroll',reveal);
function reveal() {
var reveals = document.querySelectorAll('.reveal');
for (var i=0;i<reveals.length;i++) {
var windowheight = window.innerHeight;
var revealtop = reveals[i].getBoundingClientRect().top;
var revealpoint = 150;
if(revealtop < windowheight - revealpoint){
reveals[i].classList.add("active");
}
// else{
// reveals[i].classList.remove("active");
// }
}
}