-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
350 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
.modal-pumpkin { | ||
position: absolute; | ||
top: -30px; | ||
left: 50%; | ||
transform: translateX(-50%); | ||
width: 60px; | ||
height: 60px; | ||
animation: float 3s ease-in-out infinite; | ||
} | ||
|
||
@keyframes float { | ||
0% { | ||
transform: translateX(-50%) translateY(0px); | ||
} | ||
|
||
50% { | ||
transform: translateX(-50%) translateY(-10px); | ||
} | ||
|
||
100% { | ||
transform: translateX(-50%) translateY(0px); | ||
} | ||
} | ||
|
||
@media (max-width: 480px) { | ||
.hacktoberfest-modal-title { | ||
font-size: 2rem; | ||
} | ||
|
||
.hacktoberfest-modal-body { | ||
font-size: 1rem; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
.hacktoberfest-modal-container { | ||
display: none; | ||
position: fixed; | ||
top: 0; | ||
left: 0; | ||
width: 100%; | ||
height: 100%; | ||
background-color: rgba(0, 0, 0, .7); | ||
z-index: 1000; | ||
animation: modalFadeIn .3s ease-in-out | ||
} | ||
|
||
.hacktoberfest-modal { | ||
position: fixed; | ||
top: 50%; | ||
left: 50%; | ||
transform: translate(-50%, -50%); | ||
background-color: #1a1a1a; | ||
padding: 2rem; | ||
border-radius: 12px; | ||
box-shadow: 0 0 20px rgba(255, 107, 0, .3); | ||
max-width: 500px; | ||
width: 90%; | ||
border: 2px solid #ff6b00 | ||
} | ||
|
||
.hacktoberfest-modal-header { | ||
text-align: center; | ||
margin-bottom: 1.5rem | ||
} | ||
|
||
.hacktoberfest-modal-title { | ||
font-family: Creepster, cursive; | ||
font-size: 2.5rem; | ||
color: #ff6b00; | ||
text-shadow: 2px 2px 4px rgba(0, 0, 0, .3); | ||
margin: 0; | ||
line-height: 1.2 | ||
} | ||
|
||
.hacktoberfest-modal-body { | ||
text-align: center; | ||
color: #fff; | ||
margin-bottom: 1.5rem; | ||
font-family: Poppins, sans-serif; | ||
font-size: 1.1rem; | ||
line-height: 1.6 | ||
} | ||
|
||
.hacktoberfest-modal-close { | ||
position: absolute; | ||
top: 1rem; | ||
right: 1rem; | ||
background: 0 0; | ||
border: none; | ||
font-size: 1.5rem; | ||
cursor: pointer; | ||
color: #ff6b00; | ||
padding: .5rem; | ||
line-height: 1; | ||
transition: color .2s | ||
} | ||
|
||
.hacktoberfest-modal-close:hover { | ||
color: #ff8533 | ||
} | ||
|
||
.hacktoberfest-modal-footer { | ||
text-align: center | ||
} | ||
|
||
.hacktoberfest-close-button { | ||
background-color: #ff6b00; | ||
color: #fff; | ||
border: none; | ||
padding: .75rem 2rem; | ||
border-radius: 4px; | ||
cursor: pointer; | ||
font-weight: 700; | ||
font-family: Poppins, sans-serif; | ||
transition: background-color .2s; | ||
font-size: 1rem; | ||
text-transform: uppercase; | ||
letter-spacing: 1px | ||
} | ||
|
||
.hacktoberfest-close-button:hover { | ||
background-color: #ff8533; | ||
transform: translateY(-2px) | ||
} | ||
|
||
@keyframes modalFadeIn { | ||
from { | ||
opacity: 0; | ||
transform: translate(-50%, -48%) | ||
} | ||
|
||
to { | ||
opacity: 1; | ||
transform: translate(-50%, -50%) | ||
} | ||
} | ||
|
||
.hacktoberfest-modal-container.show { | ||
display: block | ||
} | ||
|
||
.modal-pumpkin { | ||
position: absolute; | ||
top: -30px; | ||
left: 50%; | ||
transform: translateX(-50%); | ||
width: 60px; | ||
height: 60px; | ||
animation: float 3s ease-in-out infinite | ||
} | ||
|
||
@keyframes float { | ||
0% { | ||
transform: translateX(-50%) translateY(0) | ||
} | ||
|
||
50% { | ||
transform: translateX(-50%) translateY(-10px) | ||
} | ||
|
||
100% { | ||
transform: translateX(-50%) translateY(0) | ||
} | ||
} | ||
|
||
@media (max-width:480px) { | ||
.hacktoberfest-modal-title { | ||
font-size: 2rem | ||
} | ||
|
||
.hacktoberfest-modal-body { | ||
font-size: 1rem | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
class HacktoberfestModal { | ||
constructor() { | ||
this.modalShown = false; // Use boolean instead of !1 | ||
this.init(); | ||
} | ||
|
||
init() { | ||
const lastShown = localStorage.getItem("hacktoberfestModalLastShown"); | ||
const today = new Date().toDateString(); | ||
if (!lastShown || lastShown !== today) { | ||
this.createModal(); | ||
this.showModal(); | ||
localStorage.setItem("hacktoberfestModalLastShown", today); | ||
} | ||
} | ||
|
||
createModal() { | ||
const modalHTML = ` | ||
<div class="hacktoberfest-modal-container" id="hacktoberfestModal"> | ||
<div class="hacktoberfest-modal"> | ||
<img src="img/Pumpkin.webp" alt="Halloween Pumpkin" class="modal-pumpkin"> | ||
<button class="hacktoberfest-modal-close">×</button> | ||
<div class="hacktoberfest-modal-header"> | ||
<h2 class="hacktoberfest-modal-title">HACKTOBERFEST IS ALMOST ENDING 🎃</h2> | ||
</div> | ||
<div class="hacktoberfest-modal-body"> | ||
<p>Thank you for your participation this year! It was an amazing experience and we hope to be here again next year!</p> | ||
</div> | ||
<div class="hacktoberfest-modal-footer"> | ||
<button class="hacktoberfest-close-button">Close</button> | ||
</div> | ||
</div> | ||
</div> | ||
`; | ||
|
||
document.body.insertAdjacentHTML("beforeend", modalHTML); | ||
|
||
// Add event listener for the "X" button | ||
const closeButtonX = document.querySelector(".hacktoberfest-modal-close"); | ||
closeButtonX.addEventListener("click", () => this.hideModal()); | ||
|
||
// Add event listener for the "Close" button | ||
const closeButton = document.querySelector(".hacktoberfest-close-button"); | ||
closeButton.addEventListener("click", () => this.hideModal()); | ||
|
||
// Add event listener for the modal container | ||
document | ||
.getElementById("hacktoberfestModal") | ||
.addEventListener("click", (e) => { | ||
if (e.target.className === "hacktoberfest-modal-container") { | ||
this.hideModal(); | ||
} | ||
}); | ||
} | ||
|
||
showModal() { | ||
const modal = document.getElementById("hacktoberfestModal"); | ||
if (modal) { | ||
modal.classList.add("show"); | ||
this.modalShown = true; | ||
} | ||
} | ||
|
||
hideModal() { | ||
const modal = document.getElementById("hacktoberfestModal"); | ||
if (modal) { | ||
modal.classList.remove("show"); | ||
this.modalShown = false; | ||
} | ||
} | ||
} | ||
|
||
document.addEventListener("DOMContentLoaded", () => { | ||
new HacktoberfestModal(); | ||
}); |
Oops, something went wrong.