-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
98 lines (85 loc) · 2.93 KB
/
script.js
File metadata and controls
98 lines (85 loc) · 2.93 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
document.addEventListener('DOMContentLoaded', function() {
// Animate elements on page load
animateElements();
// Add parallax effect to header background
const header = document.querySelector('header');
window.addEventListener('scroll', function() {
const scrollPosition = window.scrollY;
if (header) {
header.style.backgroundPosition = `center ${scrollPosition * 0.4}px`;
}
});
// Add hover effects to timeline items
const timeBlocks = document.querySelectorAll('.time-block');
timeBlocks.forEach(block => {
block.addEventListener('mouseenter', function() {
this.style.transform = 'scale(1.02)';
this.style.transition = 'transform 0.3s ease';
});
block.addEventListener('mouseleave', function() {
this.style.transform = 'scale(1)';
});
});
});
function animateElements() {
// Animate price tag with a slight bounce effect
const priceTag = document.querySelector('.price-tag');
if (priceTag) {
setTimeout(() => {
priceTag.style.animation = 'bounce 0.5s ease';
priceTag.style.transform = 'scale(1.1)';
setTimeout(() => {
priceTag.style.transform = 'scale(1)';
priceTag.style.transition = 'transform 0.3s ease';
}, 500);
}, 300);
}
// Fade in timeline items sequentially
const timeBlocks = document.querySelectorAll('.time-block');
timeBlocks.forEach((block, index) => {
block.style.opacity = '0';
block.style.transform = 'translateY(20px)';
block.style.transition = 'opacity 0.5s ease, transform 0.5s ease';
setTimeout(() => {
block.style.opacity = '1';
block.style.transform = 'translateY(0)';
}, 200 + (index * 150));
});
// Add a subtle highlight effect to service items
const serviceItems = document.querySelectorAll('.services li');
serviceItems.forEach((item, index) => {
item.style.opacity = '0';
item.style.transform = 'translateX(-20px)';
item.style.transition = 'opacity 0.5s ease, transform 0.5s ease';
setTimeout(() => {
item.style.opacity = '1';
item.style.transform = 'translateX(0)';
}, 300 + (index * 100));
});
}
// Add CSS animation for bounce effect
document.head.insertAdjacentHTML('beforeend', `
<style>
@keyframes bounce {
0%, 100% { transform: scale(1); }
50% { transform: scale(1.2); }
}
@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
.highlight-box img {
transition: transform 0.5s ease;
}
.highlight-box:hover img {
transform: scale(1.05);
}
</style>
`);
// Add current time to display when the page loads
const currentDate = new Date();
const formattedDate = currentDate.toLocaleDateString('vi-VN', {
year: 'numeric',
month: 'long',
day: 'numeric'
});