Created
December 3, 2023 04:07
-
-
Save amitroy06/51b9572210bcd9932ce90f3cbf6d0a3d to your computer and use it in GitHub Desktop.
This file contains hidden or 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
const imageEl = document.getElementById('imageElement'); | |
const textEl = document.getElementById('textContent'); | |
const toggleEl = document.getElementById('imageToggle'); | |
toggleEl.addEventListener('change', () => { | |
imageEl.src = toggleEl.checked ? 'kitty.jpg' : 'doggo.jpg'; | |
textEl.textContent = toggleEl.checked ? 'This is a cute catto..........😼' : 'This is a cute doggo..........🐶'; | |
imageEl.classList.toggle('active'); | |
textEl.classList.toggle('active'); | |
}); |
This file contains hidden or 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
*{ | |
margin: 0; | |
padding: 0; | |
} | |
body { | |
font-family: sans-serif; | |
margin: 0; | |
padding: 20px; | |
display: flex; | |
justify-content: center; | |
align-items: center; | |
min-height: 100vh; | |
background-color: rgb(14, 68, 14); | |
} | |
.container { | |
border-radius: 10px; | |
box-shadow: 0 10px 30px rgba(11, 11, 11, 0.961); | |
background-color: rgb(36, 135, 63); | |
padding: 20px; | |
} | |
.heading { | |
font-size: 30px; | |
margin-bottom: 20px; | |
text-align: center; | |
font-family: Nabla; | |
color: black; | |
font-size: 40PX; | |
text-shadow: 5px 5px 3px black; | |
} | |
.image-container { | |
width: 800px; | |
height: 600px; | |
border-radius: 10px; | |
overflow: hidden; | |
} | |
.image-container img { | |
width: 100%; | |
height: 100%; | |
object-fit: cover; | |
} | |
.text { | |
padding: 0.5rem 2rem; | |
font-family: 'Cute Font', sans-serif; | |
font-size: 50px; | |
text-shadow: 3px 3px 2px rgb(246, 246, 246); | |
} | |
.toggle{ | |
display: flex; | |
align-items: center; | |
gap: 20px; | |
} | |
.toggle-label { | |
margin-top: 10px; | |
font-size: 30px; | |
color: #f5f2f2; | |
font-family: 'Aoboshi One', serif; | |
font-size: 30px; | |
text-shadow: 3px 3px 2px rgb(0, 0, 0); | |
} | |
.toggle-button { | |
appearance: none; | |
width: 80px; | |
height: 30px; | |
border: 4px solid #030303; | |
border-radius: 25px; | |
background-color: #ffffff; | |
cursor: pointer; | |
margin-top: auto; | |
} | |
.toggle-button:checked { | |
background-color: #000000; | |
border: 4px solid #ffffff; | |
} | |
.toggle-button::after { | |
display: block; | |
width: 20px; | |
height: 20px; | |
border-radius: 50%; | |
background-color: #f5f5f5; | |
position: absolute; | |
top: 2.5px; | |
left: 2.5px; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment