Skip to content

Commit 10e7ef5

Browse files
committed
init of repo 26
1 parent 6e23632 commit 10e7ef5

File tree

2 files changed

+472
-0
lines changed

2 files changed

+472
-0
lines changed
Lines changed: 252 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,252 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Follow Along Nav</title>
6+
</head>
7+
<body>
8+
<h2>Cool</h2>
9+
<nav class="top">
10+
<div class="dropdownBackground">
11+
<span class="arrow"></span>
12+
</div>
13+
14+
<ul class="cool">
15+
<li>
16+
<a href="#">About Me</a>
17+
<div class="dropdown dropdown1">
18+
<div class="bio">
19+
<img src="https://logo.clearbit.com/wesbos.com">
20+
<p>Wes Bos sure does love web development. He teaches things like JavaScript, CSS and BBQ. Wait. BBQ isn't part of web development. It should be though!</p>
21+
</div>
22+
</div>
23+
</li>
24+
<li>
25+
<a href="#">Courses</a>
26+
<ul class="dropdown courses">
27+
<li>
28+
<span class="code">RFB</span>
29+
<a href="https://ReactForBeginners.com">React For Beginners</a>
30+
</li>
31+
<li>
32+
<span class="code">ES6</span>
33+
<a href="https://ES6.io">ES6 For Everyone</a>
34+
</li>
35+
<li>
36+
<span class="code">STPU</span>
37+
<a href="https://SublimeTextBook.com">Sublime Text Power User</a>
38+
</li>
39+
<li>
40+
<span class="code">WTF</span>
41+
<a href="http://flexbox.io">What The Flexbox?!</a>
42+
</li>
43+
<li>
44+
<span class="code">LRX</span>
45+
<a href="http://LearnRedux.com">Learn Redux</a>
46+
</li>
47+
<li>
48+
<span class="code">CLPU</span>
49+
<a href="http://CommandLinePowerUser.com">Command Line Power User</a>
50+
</li>
51+
<li>
52+
<span class="code">MMD</span>
53+
<a href="http://MasteringMarkdown.com">Mastering Markdown</a>
54+
</li>
55+
</ul>
56+
</li>
57+
<li>
58+
<a href="#">Other Links</a>
59+
<ul class="dropdown dropdown3">
60+
<li><a class="button" href="http://twitter.com/wesbos">Twiter</a></li>
61+
<li><a class="button" href="http://facebook.com/wesbos.developer">Facebook</a></li>
62+
<li><a class="button" href="http://wesbos.com">Blog</a></li>
63+
<li><a class="button" href="http://wesbos.com/courses">Course Catalog</a></li>
64+
</ul>
65+
</li>
66+
</ul>
67+
</nav>
68+
69+
<style>
70+
html {
71+
box-sizing: border-box;
72+
font-family: "Arial Rounded MT Bold","Helvetica Rounded",Arial,sans-serif
73+
}
74+
*, *:before, *:after {
75+
box-sizing: inherit;
76+
}
77+
body {
78+
margin: 0;
79+
min-height: 100vh;
80+
background:
81+
linear-gradient(45deg, hsla(340, 100%, 55%, 1) 0%, hsla(340, 100%, 55%, 0) 70%),
82+
linear-gradient(135deg, hsla(225, 95%, 50%, 1) 10%, hsla(225, 95%, 50%, 0) 80%),
83+
linear-gradient(225deg, hsla(140, 90%, 50%, 1) 10%, hsla(140, 90%, 50%, 0) 80%),
84+
linear-gradient(315deg, hsla(35, 95%, 55%, 1) 100%, hsla(35, 95%, 55%, 0) 70%);
85+
}
86+
87+
h2 {
88+
margin-top: 0;
89+
padding-top: .8em;
90+
}
91+
92+
nav {
93+
position: relative;
94+
perspective: 600px;
95+
}
96+
97+
.cool > li > a {
98+
color: yellow;
99+
text-decoration: none;
100+
font-size: 20px;
101+
background: rgba(0,0,0,0.2);
102+
padding:10px 20px;
103+
display: inline-block;
104+
margin:20px;
105+
border-radius:5px;
106+
}
107+
108+
nav ul {
109+
list-style: none;
110+
margin: 0;
111+
padding: 0;
112+
display: flex;
113+
justify-content: center;
114+
}
115+
116+
.cool > li {
117+
position: relative;
118+
display:flex;
119+
justify-content: center;
120+
}
121+
122+
.dropdown {
123+
opacity: 0;
124+
position: absolute;
125+
overflow: hidden;
126+
padding:20px;
127+
top:-20px;
128+
border-radius:2px;
129+
transition: all 0.5s;
130+
transform: translateY(100px);
131+
will-change: opacity;
132+
display: none;
133+
}
134+
135+
.trigger-enter .dropdown {
136+
display: block;
137+
}
138+
139+
.trigger-enter-active .dropdown {
140+
opacity: 1;
141+
}
142+
143+
144+
145+
.dropdownBackground {
146+
width:100px;
147+
height:100px;
148+
position: absolute;
149+
background: #fff;
150+
border-radius: 4px;
151+
box-shadow: 0 50px 100px rgba(50,50,93,.1), 0 15px 35px rgba(50,50,93,.15), 0 5px 15px rgba(0,0,0,.1);
152+
transition:all 0.3s, opacity 0.1s, transform 0.2s;
153+
transform-origin: 50% 0;
154+
display: flex;
155+
justify-content: center;
156+
opacity:0;
157+
}
158+
159+
.dropdownBackground.open {
160+
opacity: 1;
161+
}
162+
163+
.arrow {
164+
position: absolute;
165+
width:20px;
166+
height:20px;
167+
display: block;
168+
background:white;
169+
transform: translateY(-50%) rotate(45deg);
170+
}
171+
172+
.bio {
173+
min-width:500px;
174+
display:flex;
175+
justify-content: center;
176+
align-items: center;
177+
line-height: 1.7;
178+
}
179+
180+
.bio img {
181+
float:left;
182+
margin-right:20px;
183+
}
184+
185+
.courses {
186+
min-width:300px;
187+
}
188+
189+
.courses li {
190+
padding: 10px 0;
191+
display: block;
192+
border-bottom: 1px solid rgba(0,0,0,0.2);
193+
}
194+
195+
.dropdown a {
196+
text-decoration: none;
197+
color: #ffc600;
198+
}
199+
200+
a.button {
201+
background:black;
202+
display: block;
203+
padding:10px;
204+
color:white;
205+
margin-bottom: 10px;
206+
}
207+
208+
209+
/* Matches Twitter, TWITTER, twitter, tWitter, TWiTTeR... */
210+
.button[href*=twitter] { background: #019FE9; }
211+
.button[href*=facebook] { background: #3B5998; }
212+
.button[href*=courses] { background: #ffc600; }
213+
214+
</style>
215+
216+
<script>
217+
const triggers = document.querySelectorAll('.cool > li');
218+
const background = document.querySelector('.dropdownBackground');
219+
const nav = document.querySelector('.top');
220+
221+
function handleEnter() {
222+
this.classList.add('trigger-enter');
223+
setTimeout(() => this.classList.contains('trigger-enter') && this.classList.add('trigger-enter-active'), 150);
224+
background.classList.add('open');
225+
226+
const dropdown = this.querySelector('.dropdown');
227+
const dropdownCoords = dropdown.getBoundingClientRect();
228+
const navCoords = nav.getBoundingClientRect();
229+
230+
const coords = {
231+
height: dropdownCoords.height,
232+
width: dropdownCoords.width,
233+
top: dropdownCoords.top - navCoords.top,
234+
left: dropdownCoords.left - navCoords.left
235+
};
236+
237+
background.style.setProperty('width', `${coords.width}px`);
238+
background.style.setProperty('height', `${coords.height}px`);
239+
background.style.setProperty('transform', `translate(${coords.left}px, ${coords.top}px)`);
240+
}
241+
242+
function handleLeave() {
243+
this.classList.remove('trigger-enter', 'trigger-enter-active');
244+
background.classList.remove('open');
245+
}
246+
247+
triggers.forEach(trigger => trigger.addEventListener('mouseenter', handleEnter));
248+
triggers.forEach(trigger => trigger.addEventListener('mouseleave', handleLeave));
249+
</script>
250+
251+
</body>
252+
</html>

0 commit comments

Comments
 (0)