Showing
5 changed files
with
290 additions
and
0 deletions
Readme.md
0 → 100644
File mode changed
css/style.css
0 → 100644
No preview for this file type
css/style.scss
0 → 100644
1 | +@import url(https://fonts.googleapis.com/css?family=Exo); | ||
2 | + | ||
3 | +$white: #fff; | ||
4 | +$black: #000; | ||
5 | +$main-black: #333; | ||
6 | +$green: #3ac28c; | ||
7 | +$lucifer: #666; | ||
8 | + | ||
9 | +html,body { | ||
10 | + font-family: 'Exo', sans-serif; | ||
11 | + background-color: $main-black; | ||
12 | + height: 100%; | ||
13 | + width: 100%; | ||
14 | + position: relative; | ||
15 | +} | ||
16 | + | ||
17 | +a.button { | ||
18 | + text-decoration: none; | ||
19 | + padding: 20px; | ||
20 | + display: inline-block; | ||
21 | + border: 1px solid $white; | ||
22 | + position: absolute; | ||
23 | + top: 50%; | ||
24 | + left: 50%; | ||
25 | + color: $white; | ||
26 | + transform: translate(-50%,-50%); | ||
27 | + transition: all .4s; | ||
28 | + | ||
29 | + &:hover { | ||
30 | + border-color: $green; | ||
31 | + color: $green; | ||
32 | + } | ||
33 | +} | ||
34 | + | ||
35 | +.modal-overlay { | ||
36 | + background: $main-black; | ||
37 | + bottom: 0; | ||
38 | + left: 0; | ||
39 | + position: fixed; | ||
40 | + right: 0; | ||
41 | + text-align: center; | ||
42 | + text-shadow: none; | ||
43 | + top: 0; | ||
44 | + opacity: 0; | ||
45 | + transform: scale(.5); | ||
46 | + transition: all .75s cubic-bezier(.68, -.55, .265, 1.55); | ||
47 | + z-index: -100; | ||
48 | +} | ||
49 | + | ||
50 | +.modal-wrapper { | ||
51 | + padding: 1em 0; | ||
52 | + position: relative; | ||
53 | + margin: 0 auto; | ||
54 | + max-width: 500px; | ||
55 | + width: 90%; | ||
56 | + | ||
57 | + .close { | ||
58 | + padding: 14px; | ||
59 | + position: absolute; | ||
60 | + right: .5em; | ||
61 | + top: 2.5em; | ||
62 | + width: 1.5em; | ||
63 | + cursor: pointer; | ||
64 | + | ||
65 | + &:before, | ||
66 | + &:after { | ||
67 | + content: ''; | ||
68 | + position: absolute; | ||
69 | + display: block; | ||
70 | + width: 2px; | ||
71 | + height: 36px; | ||
72 | + background-color: $green; | ||
73 | + top:-5px; | ||
74 | + } | ||
75 | + | ||
76 | + &:before { | ||
77 | + transform: rotate(45deg); | ||
78 | + } | ||
79 | + | ||
80 | + &:after { | ||
81 | + transform: rotate(-45deg); | ||
82 | + } | ||
83 | + } | ||
84 | + | ||
85 | + h2 { | ||
86 | + color: $white; | ||
87 | + margin-bottom: 1em; | ||
88 | + text-transform: uppercase; | ||
89 | + } | ||
90 | +} | ||
91 | + | ||
92 | +@media (min-width: 50em) { | ||
93 | + .modal-wrapper { | ||
94 | + padding: 1.75em; | ||
95 | + } | ||
96 | +} | ||
97 | +@media (min-height: 37.5em) { | ||
98 | + .modal-wrapper { | ||
99 | + left: 50%; | ||
100 | + position: absolute; | ||
101 | + top: 50%; | ||
102 | + transform: translate(-50%, -50%); | ||
103 | + } | ||
104 | +} | ||
105 | + | ||
106 | +.active + .modal-overlay { | ||
107 | + opacity: 1; | ||
108 | + transform: scale(1); | ||
109 | + z-index: 800; | ||
110 | +} | ||
111 | + | ||
112 | +.message-form { | ||
113 | + clear: both; | ||
114 | + height: 350px; | ||
115 | + | ||
116 | + .input-button { | ||
117 | + text-align: center; | ||
118 | + padding: 20px; | ||
119 | + | ||
120 | + .button { | ||
121 | + border: 1px solid $white; | ||
122 | + background-color: transparent; | ||
123 | + padding: 10px 20px; | ||
124 | + transition: all .4s; | ||
125 | + color: $white; | ||
126 | + font-family: 'Exo', sans-serif; | ||
127 | + cursor: pointer; | ||
128 | + | ||
129 | + &:hover { | ||
130 | + color: $green; | ||
131 | + border-color: $green; | ||
132 | + } | ||
133 | + } | ||
134 | + } | ||
135 | + | ||
136 | + .input-box { | ||
137 | + font-size: 16px; | ||
138 | + line-height: 24px; | ||
139 | + width: 100%; | ||
140 | + height: 72px; | ||
141 | + display: block; | ||
142 | + position: relative; | ||
143 | + | ||
144 | + &.focus { | ||
145 | + .input-label { | ||
146 | + color: $green; | ||
147 | + transform: perspective(1px) scale(.75) translate3d(0, -18px, 0); | ||
148 | + } | ||
149 | + | ||
150 | + .underline-focus { | ||
151 | + transform: scaleX(1); | ||
152 | + } | ||
153 | + | ||
154 | + &.textarea { | ||
155 | + overflow-y: hidden; | ||
156 | + height: 200px; /* approximate max height */ | ||
157 | + padding: 0 0 60px; | ||
158 | + | ||
159 | + .input-text { | ||
160 | + max-height: 200px; | ||
161 | + margin-top: 45px; | ||
162 | + padding-top: 0; | ||
163 | + } | ||
164 | + } | ||
165 | + } | ||
166 | + | ||
167 | + &.textarea { | ||
168 | + transition-property: all; | ||
169 | + transition-duration: .5s; | ||
170 | + transition-timing-function: cubic-bezier(0, 1, .5, 1); | ||
171 | + | ||
172 | + .input-text { | ||
173 | + resize: none; | ||
174 | + overflow: hidden; | ||
175 | + } | ||
176 | + } | ||
177 | + | ||
178 | + .input-label { | ||
179 | + position: absolute; | ||
180 | + line-height: 48px; | ||
181 | + opacity: 1; | ||
182 | + color: $lucifer; | ||
183 | + transition: all 450ms cubic-bezier(.23, 1, .32, 1) 0ms; | ||
184 | + top: 24px; | ||
185 | + transform: scale(1) translate3d(0, 0, 0); | ||
186 | + transform-origin: left top 0; | ||
187 | + } | ||
188 | + | ||
189 | + .input-text { | ||
190 | + -webkit-tap-highlight-color: rgba(0,0,0,0); | ||
191 | + position: relative; | ||
192 | + width: 100%; | ||
193 | + height: 100%; | ||
194 | + border: 0; | ||
195 | + outline: none; | ||
196 | + background-color: transparent; | ||
197 | + color: $white; | ||
198 | + box-sizing: border-box; | ||
199 | + padding-top: 36px; | ||
200 | + box-shadow: none; | ||
201 | + padding-left: 0; | ||
202 | + font-size: 18px; | ||
203 | + } | ||
204 | + | ||
205 | + .underline { | ||
206 | + border: 0; | ||
207 | + border-bottom: solid 1px #e0e0e0; | ||
208 | + position: absolute; | ||
209 | + width: 100%; | ||
210 | + bottom: 8px; | ||
211 | + margin: 0; | ||
212 | + // false: content-box; | ||
213 | + box-sizing: content-box; | ||
214 | + height: 0; | ||
215 | + } | ||
216 | + | ||
217 | + .underline-focus { | ||
218 | + border-style: none none solid; | ||
219 | + border-bottom-width: 2px; | ||
220 | + position: absolute; | ||
221 | + width: 100%; | ||
222 | + bottom: 8px; | ||
223 | + margin: 0; | ||
224 | + box-sizing: content-box; | ||
225 | + height: 0; | ||
226 | + border-color: $green; | ||
227 | + transform: scaleX(0); | ||
228 | + transition: all 450ms cubic-bezier(.23, 1, .32, 1) 0ms; | ||
229 | + } | ||
230 | + } | ||
231 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
index.html
0 → 100644
1 | +<html> | ||
2 | + <head> | ||
3 | + <link rel="stylesheet" href="css/style.css"> | ||
4 | + </head> | ||
5 | + <body> | ||
6 | + <a href="#" class="button">How much are you earning now?</a> | ||
7 | + <div class="modal-overlay"> | ||
8 | + <div class="modal-wrapper"> | ||
9 | + <label class="close" for=""></label> | ||
10 | + <h2 id="modal-title">Envoyez-nous un message</h2> | ||
11 | + <form class="message-form" action=""> | ||
12 | + <div class="input-box"> | ||
13 | + <label for="" class="input-label">Nom</label> | ||
14 | + <input type="text" class="input-text"> | ||
15 | + <hr class="underline"> | ||
16 | + <hr class="underline-focus"> | ||
17 | + </div> | ||
18 | + <div class="input-box"> | ||
19 | + <label for="" class="input-label">E-mail</label> | ||
20 | + <input type="text" class="input-text"> | ||
21 | + <hr class="underline"> | ||
22 | + <hr class="underline-focus"> | ||
23 | + </div> | ||
24 | + <div class="input-box textarea"> | ||
25 | + <label for="" class="input-label">Message</label> | ||
26 | + <textarea class="input-text"></textarea> | ||
27 | + <hr class="underline"> | ||
28 | + <hr class="underline-focus"> | ||
29 | + </div> | ||
30 | + <div class="input-button"> | ||
31 | + <button class="button">Envoyer</button> | ||
32 | + </div> | ||
33 | + </form> | ||
34 | + </div> | ||
35 | + </div> | ||
36 | + <script type="text/javascript" src="js/script.js"></script> | ||
37 | + </body> | ||
38 | + | ||
39 | +</html> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
js/script.js
0 → 100644
1 | +$('.button').on('click', function(e) { | ||
2 | + e.preventDefault(); | ||
3 | + $(this).addClass('active'); | ||
4 | +}); | ||
5 | + | ||
6 | +$('.modal-wrapper').find('label').on('click', function() { | ||
7 | + $('.button').removeClass('active'); | ||
8 | +}); | ||
9 | + | ||
10 | +$('.input-text').focus(function() { | ||
11 | + $(this).parents('.input-box').addClass('focus'); | ||
12 | +}) | ||
13 | + | ||
14 | +$('.input-text').blur(function() { | ||
15 | + if ($(this).val()) { | ||
16 | + $(this).parents('.input-box').addClass('focus'); | ||
17 | + } else { | ||
18 | + $(this).parents('.input-box').removeClass('focus'); | ||
19 | + } | ||
20 | +}); | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
-
Please register or login to post a comment