forked from PriyaGhosal/BuddyTrail
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gear.html
190 lines (174 loc) · 8.15 KB
/
gear.html
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Adventure Trip Planner</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="gear.css" rel="stylesheet">
<style>
/* circle styles */
.circle {
height: 24px;
width: 24px;
border-radius: 24px;
background-color: rgb(255, 0, 0);
position: fixed;
top: 0;
left: 0;
pointer-events: none;
z-index: 99999999;
}
</style>
</head>
<body>
<div class="container mt-5">
<h1 class="text-center mb-4">Adventure Trip Planner</h1>
<div class="row" id="tripListings">
<div class="col-md-4 mb-4">
<div class="card h-100 trip-card" data-trip="mountain" tabindex="0">
<img src="https://images.unsplash.com/photo-1464822759023-fed622ff2c3b" class="card-img-top" alt="Mountain Trip">
<div class="card-body">
<h5 class="card-title">Mountain Adventure</h5>
<p class="card-text">Destination: Rocky Mountains</p>
<p class="card-text">Duration: 7 days</p>
<p class="card-text">Difficulty: Challenging</p>
</div>
</div>
</div>
<div class="col-md-4 mb-4">
<div class="card h-100 trip-card" data-trip="beach" tabindex="0">
<img src="https://images.unsplash.com/photo-1507525428034-b723cf961d3e" class="card-img-top" alt="Beach Trip">
<div class="card-body">
<h5 class="card-title">Tropical Paradise</h5>
<p class="card-text">Destination: Bali</p>
<p class="card-text">Duration: 10 days</p>
<p class="card-text">Difficulty: Easy</p>
</div>
</div>
</div>
<div class="col-md-4 mb-4">
<div class="card h-100 trip-card" data-trip="safari" tabindex="0">
<img src="https://images.unsplash.com/photo-1516426122078-c23e76319801" class="card-img-top" alt="Safari Trip">
<div class="card-body">
<h5 class="card-title">African Safari</h5>
<p class="card-text">Destination: Serengeti</p>
<p class="card-text">Duration: 14 days</p>
<p class="card-text">Difficulty: Moderate</p>
</div>
</div>
</div>
</div>
<div id="gearSection" class="mt-5 d-none">
<h2 class="mb-4">Required Gear</h2>
<div id="gearList" class="row"></div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
<script>
const trips = {
mountain: [
{ name: "Hiking Boots", description: "Durable and waterproof boots for rough terrain", image: "https://images.unsplash.com/photo-1582588678413-dbf45f4823e9" },
{ name: "Backpack", description: "Large capacity backpack for multi-day hikes", image: "https://images.unsplash.com/photo-1553062407-98eeb64c6a62" },
{ name: "Sleeping Bag", description: "Insulated sleeping bag for cold nights", image: "https://images.unsplash.com/photo-1504280390367-361c6d9f38f4" }
],
beach: [
{ name: "Sunscreen", description: "High SPF sunscreen for UV protection", image: "https://images.unsplash.com/photo-1526434630747-bdd209ae46c2" },
{ name: "Snorkel Set", description: "Mask, snorkel, and fins for underwater exploration", image: "https://images.unsplash.com/photo-1544551763-46a013bb70d5" },
{ name: "Beach Towel", description: "Quick-dry towel for beach activities", image: "https://images.unsplash.com/photo-1590480598135-3be152c87913" }
],
safari: [
{ name: "Binoculars", description: "High-power binoculars for wildlife viewing", image: "https://images.unsplash.com/photo-1551524559-8af4e6624178" },
{ name: "Safari Hat", description: "Wide-brimmed hat for sun protection", image: "https://images.unsplash.com/photo-1582791694770-cbdc9dda338f" },
{ name: "Insect Repellent", description: "DEET-based repellent for mosquito protection", image: "https://images.unsplash.com/photo-1588872657578-7efd1f1555ed" }
]
};
document.querySelectorAll('.trip-card').forEach(card => {
card.addEventListener('click', function() {
const tripType = this.dataset.trip;
const gearList = trips[tripType];
const gearSection = document.getElementById('gearSection');
const gearListEl = document.getElementById('gearList');
gearListEl.innerHTML = '';
if (gearList && gearList.length > 0) {
gearList.forEach(gear => {
const gearCard = `
<div class="col-md-4 mb-4">
<div class="card h-100">
<img src="${gear.image}" class="card-img-top" alt="${gear.name}">
<div class="card-body">
<h5 class="card-title">${gear.name}</h5>
<p class="card-text">${gear.description}</p>
<button class="btn btn-primary">Add to Cart 🛒</button>
</div>
</div>
</div>
`;
gearListEl.innerHTML += gearCard;
});
gearSection.classList.remove('d-none');
} else {
gearListEl.innerHTML = '<p class="col-12 text-center">No gears required for this trip.</p>';
gearSection.classList.remove('d-none');
}
});
});
</script>
<!-- Circles -->
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<script>
// coordinates for the cursor :
const coords = { x: 0, y: 0 };
const circles = document.querySelectorAll(".circle");
const colors = [
"#fc5720", "#fc6532", "#fc6532","#fd8b65", "#d5585c", "#fac3b1", "#f4d5cb", "#fefefe", "#fefefe", "#cdf2c5", "#b2eca5", "#95e283", "#7dda68", "#4adc2d", "#69d451", "#54c939", "#34b916", "#28b309", "#1e9c02",
];
circles.forEach(function (circle, index) {
circle.x = 0;
circle.y = 0;
circle.style.backgroundColor = colors[index % colors.length];
});
// update the coordinates when the mouse moves:
window.addEventListener("mousemove", function (e) {
coords.x = e.clientX;
coords.y = e.clientY;
});
// animation function to move the circles:
function animateCircles() {
let x = coords.x;
let y = coords.y;
circles.forEach(function (circle, index) {
circle.style.left = x - 12 + "px";
circle.style.top = y - 12 + "px";
circle.style.scale = (circles.length - index) / circles.length;
circle.x = x;
circle.y = y;
const nextCircle = circles[index + 1] || circles[0];
x += (nextCircle.x - x) * 0.3;
y += (nextCircle.y - y) * 0.3;
});
requestAnimationFrame(animateCircles);
}
animateCircles();
</script>
</body>
</html>