-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
82 lines (69 loc) · 2.47 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
// Preloader
window.addEventListener('load', () => {
document.getElementById('preloader').style.display = 'none';
});
// Smooth Scrolling
document.addEventListener('DOMContentLoaded', () => {
const scroll = new SmoothScroll('a[href*="#"]');
});
// Header Scroll
window.addEventListener('scroll', () => {
const header = document.querySelector('.header');
header.classList.toggle('active', window.scrollY > 0);
});
// AOS Initialization
AOS.init({
duration: 800,
easing: 'ease-out-quart',
once: true
});
window.addEventListener('load', () => {
document.getElementById('preloader').style.display = 'none';
});
document.addEventListener('DOMContentLoaded', () => {
const scroll = new SmoothScroll('a[href*="#"]');
});
window.addEventListener('scroll', () => {
const header = document.querySelector('.header');
header.classList.toggle('active', window.scrollY > 0);
});
AOS.init({
duration: 800,
easing: 'ease-out-quart',
once: true
});
window.addEventListener('scroll', function() {
var link = document.getElementById('error-page-link');
if (window.innerHeight + window.scrollY >= document.body.offsetHeight) {
// You're at the bottom of the page
link.style.opacity = '1';
} else {
// You're not at the bottom of the page
link.style.opacity = '0';
}
});
// Skill Filtering
const skillFilters = document.querySelectorAll('.skill-filters button');
const skillItems = document.querySelectorAll('.skill-item');
skillFilters.forEach(filter => {
filter.addEventListener('click', () => {
const filterValue = filter.dataset.filter; // Get the data-filter value
// Remove "active" class from all filter buttons
skillFilters.forEach(btn => btn.classList.remove('active'));
// Add "active" class to the clicked button
filter.classList.add('active');
skillItems.forEach(item => {
if (filterValue === 'all' || item.dataset.filter === filterValue) {
item.style.display = 'block'; // Show the skill item
} else {
item.style.display = 'none'; // Hide the skill item
}
});
});
});
// Sidebar Toggle Functionality
const sidebarToggle = document.getElementById('sidebar-toggle');
const sidebar = document.getElementById('sidebar');
sidebarToggle.addEventListener('click', () => {
sidebar.classList.toggle('active');
});