forked from TheOdinProject/css-exercises
-
Notifications
You must be signed in to change notification settings - Fork 0
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
17 changed files
with
145 additions
and
338 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,20 @@ | ||
# Popup | ||
|
||
In this exercise we have set up a simple pop-up dialog for you. It already works! Load up index.html and give it a shot! | ||
|
||
You don't need to worry about the actual functionality here, we've just written a little javascript that adds and removes a `.show` class to the popup and the backdrop. Your task then is to make it _move_, as in the desired-outcome image below. | ||
|
||
### Hints | ||
- "modal" is another word for 'pop-up' | ||
- In the code we've provided, the popup is sitting in it's final position, so you'll need to change it's initial position, and then use a transition to move it back to the center. | ||
- You might want to change the initial opacity from 0% to something like 20% while you're working on it, so you can easily see where it is coming from before you click the button. | ||
- Don't overthink this one... it might seem complicated, but it requires just a few lines of code. | ||
|
||
## Desired Outcome | ||
|
||
![outcome](./desired-outcome.gif) | ||
|
||
### Self Check | ||
|
||
- The pop-up slides down into position when you click the open button, and slides back up when you click 'close modal' | ||
- The opacity fades smoothly in and out when toggling the modal. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
5 changes: 3 additions & 2 deletions
5
animation/03-pop-up/script.js → animation/02-pop-up/script.js
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 @@ | ||
* { | ||
padding: 0; | ||
margin: 0; | ||
} | ||
|
||
body { | ||
overflow: hidden; | ||
} | ||
|
||
.button-container { | ||
width: 100vw; | ||
height: 100vh; | ||
background-color: #ffffff; | ||
opacity: 100%; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
} | ||
|
||
button { | ||
padding: 20px; | ||
color: #ffffff; | ||
background-color: #0e79dd; | ||
border: none; | ||
border-radius: 5px; | ||
font-weight: 600; | ||
} | ||
|
||
.popup-modal { | ||
padding: 32px 64px; | ||
background-color: white; | ||
border: 1px solid black; | ||
border-radius: 10px; | ||
position: fixed; | ||
top: 50%; | ||
left: 50%; | ||
transform-origin: center; | ||
transform: translate(-50%, -50%); | ||
pointer-events: none; | ||
opacity: 0%; | ||
text-align: center; | ||
} | ||
.popup-modal p { | ||
margin-bottom: 24px | ||
} | ||
|
||
.backdrop { | ||
pointer-events: none; | ||
position: fixed; | ||
inset: 0; | ||
background: #000; | ||
opacity: 0%; | ||
} | ||
|
||
.popup-modal.show { | ||
opacity: 100%; | ||
pointer-events: all; | ||
} | ||
|
||
.backdrop.show { | ||
opacity: 30%; | ||
} | ||
|
||
/* SOLUTION */ | ||
|
||
.popup-modal { | ||
transition: transform .3s ease-in-out, opacity .4s ease; | ||
transform: translate(-50%, -100%); | ||
} | ||
|
||
.popup-modal.show { | ||
transform: translate(-50%, -50%); | ||
} | ||
|
||
|
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
5 changes: 3 additions & 2 deletions
5
animation/03-pop-up/solution/solution.js → animation/02-pop-up/solution/solution.js
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
Oops, something went wrong.