-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
127 lines (111 loc) · 3.58 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
$(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');
if (window.scrollY > 60) {
document.querySelector('#scroll-top').classList.add('active');
} else {
document.querySelector('#scroll-top').classList.remove('active');
}
});
});
document.addEventListener('visibilitychange',
function () {
if (document.visibilityState === "visible") {
document.title = "Projects | Portfolio Priyodit Choudhary";
$("#favicon").attr("href", "/assets/images/favicon.png");
}
else {
document.title = "Come Back To Portfolio";
$("#favicon").attr("href", "/assets/images/favhand.png");
}
});
// fetch projects start
function getProjects() {
return fetch("projects.json")
.then(response => response.json())
.then(data => {
return data
});
}
function showProjects(projects) {
let projectsContainer = document.querySelector(".work .box-container");
let projectsHTML = "";
projects.forEach(project => {
projectsHTML += `
<div class="grid-item ${project.category}">
<div class="box tilt" style="width: 380px; margin: 1rem">
<img draggable="false" src="/assets/images/projects/${project.image}.png" alt="project" />
<div class="content">
<div class="tag">
<h3>${project.name}</h3>
</div>
<div class="desc">
<p>${project.desc}</p>
<div class="btns">
<a href="${project.links.view}" class="btn" target="_blank"><i class="fas fa-eye"></i> View</a>
<a href="${project.links.code}" class="btn" target="_blank">Code <i class="fas fa-code"></i></a>
</div>
</div>
</div>
</div>
</div>`
});
projectsContainer.innerHTML = projectsHTML;
// vanilla tilt.js
// VanillaTilt.init(document.querySelectorAll(".tilt"), {
// max: 20,
// });
// // vanilla tilt.js
// /* ===== SCROLL REVEAL ANIMATION ===== */
// const srtop = ScrollReveal({
// origin: 'bottom',
// distance: '80px',
// duration: 1000,
// reset: true
// });
// /* SCROLL PROJECTS */
// srtop.reveal('.work .box', { interval: 200 });
// isotope filter products
var $grid = $('.box-container').isotope({
itemSelector: '.grid-item',
layoutMode: 'fitRows',
masonry: {
columnWidth: 200
}
});
// filter items on button click
$('.button-group').on('click', 'button', function () {
$('.button-group').find('.is-checked').removeClass('is-checked');
$(this).addClass('is-checked');
var filterValue = $(this).attr('data-filter');
$grid.isotope({ filter: filterValue });
});
}
getProjects().then(data => {
showProjects(data);
})
// fetch projects end
// End of Tawk.to Live Chat
// disable developer mode
document.onkeydown = function (e) {
if (e.keyCode == 123) {
return false;
}
if (e.ctrlKey && e.shiftKey && e.keyCode == 'I'.charCodeAt(0)) {
return false;
}
if (e.ctrlKey && e.shiftKey && e.keyCode == 'C'.charCodeAt(0)) {
return false;
}
if (e.ctrlKey && e.shiftKey && e.keyCode == 'J'.charCodeAt(0)) {
return false;
}
if (e.ctrlKey && e.keyCode == 'U'.charCodeAt(0)) {
return false;
}
}