Repository navigation
Expand file tree
/
Copy pathscript.js
More file actions
81 lines (63 loc) · 2.4 KB
/
Copy pathscript.js
File metadata and controls
81 lines (63 loc) · 2.4 KB
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
// Smooth scroll to sections
document.addEventListener('DOMContentLoaded', function () {
// Your JavaScrdocument.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
e.preventDefault();
document.querySelector(this.getAttribute('href')).scrollIntoView({
behavior: 'smooth'
});
});
});
// Toggle mobile menu
const menuIcon = document.getElementById('menu-icon');
const navList = document.querySelector('.navlist');
menuIcon.addEventListener('click', () => {
navList.classList.toggle('open');
});
// Scroll to top button
const topButton = document.querySelector('.top a');
topButton.addEventListener('click', () => {
window.scrollTo({
top: 0,
behavior: 'smooth'
});
});
// Card flip effect for services boxes
document.querySelectorAll('.box').forEach(box => {
box.addEventListener('mouseenter', () => {
box.classList.add('hover');
});
box.addEventListener('mouseleave', () => {
box.classList.remove('hover');
});
});
// Image flip effect for about section
const aboutSection = document.querySelector('.about');
aboutSection.addEventListener('mouseenter', () => {
aboutSection.classList.add('hover');
});
aboutSection.addEventListener('mouseleave', () => {
aboutSection.classList.remove('hover');
});
// JavaScript to toggle the flip effect for services boxes
// JavaScript for hover effect on the services boxes
document.querySelectorAll('.box').forEach(box => {
box.addEventListener('mouseenter', () => {
box.style.transform = 'rotateY(180deg)';
});
box.addEventListener('mouseleave', () => {
box.style.transform = 'rotateY(0deg)';
});
});
// JavaScript for hover effect on the about section image
// JavaScript for hover effect with color overlay on the about section image
const aboutImg = document.querySelector('.about-img img');
aboutImg.addEventListener('mouseenter', () => {
aboutImg.style.transition = '0.3s ease'; // Optional: Add transition effect
aboutImg.style.filter = 'brightness(70%)'; // Adjust brightness as needed
aboutImg.style.backgroundColor = 'rgba(5, 180, 255, 0.5)'; // Color overlay with #05b4ff and opacity
});
aboutImg.addEventListener('mouseleave', () => {
aboutImg.style.filter = 'brightness(100%)'; // Reset brightness
aboutImg.style.backgroundColor = 'transparent'; // Reset background color
});