Skip to content

Commit 6fa9054

Browse files
committed
made it so landing on domain also has same popup
1 parent bd09da9 commit 6fa9054

File tree

2 files changed

+62
-6
lines changed

2 files changed

+62
-6
lines changed

home_page.html

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ <h3 class="never_has_there">Never Has There Been a Faster Slug</h3>
8282
</div>
8383

8484
<!--GIVING DAY ADDITIONS START HERE -->
85-
<button id="openPopup">Open Popup</button>
85+
8686

8787
<!-- The Popup -->
8888
<div id="popup" class="popup hidden">
@@ -144,14 +144,10 @@ <h2>Brief History</h2>
144144

145145

146146
// Get the elements
147-
const openPopup = document.getElementById('openPopup');
148147
const closePopup = document.getElementById('closePopup');
149148
const popup = document.getElementById('popup');
150149

151-
if (!openPopup || !closePopup || !popup) {
152-
console.error("Some elements could not be found!");
153-
return;
154-
}
150+
155151

156152
popup.classList.remove('hidden');
157153

index.html

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,27 @@ <h3 class="never_has_there">Never Has There Been a Faster Slug</h3>
8181
</div>
8282
</div>
8383

84+
<!--GIVING DAY ADDITIONS START HERE -->
85+
86+
87+
<!-- The Popup -->
88+
<div id="popup" class="popup hidden">
89+
<div class="popup-content">
90+
<span id="closePopup" class="close">&times;</span>
91+
<h3 class="giving_title">Giving Day is Here!</h3>
92+
<img src="fs_team_cornucopia.jpg" width="40%">
93+
<p class="giving_desc"> Giving Day is a 24-hour fundraising event for organizations at UC Santa Cruz, and we’re excited to be a part of it! <br>
94+
This event is extremely important to the future of our club. Giving Day has historically been our largest source of funding, and it is this support that makes our project possible. Our fundraising goal for this year is 20 thousand dollars, between community donations and event challenges.
95+
96+
The money raised during Giving Day is the difference between having a basic, rules-passing car, or one that we’re able to take to the next level and incrementally improve on a year-by-year basis.<br>
97+
<b>Even a small donation, starting at $5, can make a huge difference for our team! </b>
98+
<br> If you’d like to help, here’s the link to donate: <a href="https://give.ucsc.edu/giving-day-2024/?a=8831002" target="_blank">Formula Slug Giving Day</a> Thank you so much for considering!
99+
</p>
100+
</div>
101+
</div>
102+
103+
<!--END OF GIVING DAY ADDITIONS -->
104+
84105
<div class="main-section">
85106
<h2>What is Formula Slug?</h2>
86107
<p class = "p1">In Formula Slug, we pride ourselves on inclusivity, learning, and teamwork. We work together, designing and building a formula-style racing car. As a team, we maintain a high standard for engineering excellence and innovation. Our dedication to continuous learning, inclusive processes, and embracing challenges as opportunities for growth provides an environment where students can practice hands-on electrical and mechanical engineering, as well as manufacturing and business-related skills. Through collaboration and teamwork, we utilize our collective strengths to achieve our yearly design goals and drive towards a cleaner transportation future through hands-on engineering practice. Together, we strive to push the boundaries of automotive engineering and prepare the next generation of leaders in industry and research.</p>
@@ -117,5 +138,44 @@ <h2>Brief History</h2>
117138

118139
</script>
119140

141+
<!--START OF GIVING DAY SCRIPT-->
142+
<script>
143+
document.addEventListener("DOMContentLoaded", () => {
144+
145+
146+
// Get the elements
147+
const closePopup = document.getElementById('closePopup');
148+
const popup = document.getElementById('popup');
149+
150+
151+
152+
popup.classList.remove('hidden');
153+
154+
if (!sessionStorage.getItem('popupShown')) {
155+
// If not, show the popup
156+
popup.classList.remove('hidden');
157+
sessionStorage.setItem('popupShown', 'true'); // Mark it as shown
158+
}
159+
160+
// Event listener for closing the popup
161+
closePopup.addEventListener('click', (e) => {
162+
console.log("Closing popup..."); // Debugging log
163+
popup.classList.add('hidden'); // Hide the popup
164+
e.stopPropagation(); // Prevent event from bubbling up
165+
});
166+
167+
// Close popup if clicked outside
168+
window.addEventListener('click', (e) => {
169+
if (e.target === popup) {
170+
console.log("Closing popup due to background click..."); // Debugging log
171+
popup.classList.add('hidden'); // Hide the popup
172+
}
173+
});
174+
});
175+
</script>
176+
<!--END OF GIVING DAY SCRIPT-->
177+
120178

121179
</body>
180+
181+
</html>

0 commit comments

Comments
 (0)