Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 1 addition & 14 deletions 24 - Sticky Nav/index-START.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,20 +54,7 @@ <h1>A story about getting lost.</h1>
</div>

<script>
const nav = document.querySelector('#main');
const topOfNav = nav.offsetTop;

function fixNav() {
if(window.scrollY >= topOfNav) {
document.body.style.paddingTop = nav.offsetHeight + 'px';
document.body.classList.add('fixed-nav');
} else {
document.body.style.paddingTop = 0;
document.body.classList.remove('fixed-nav');
}
}

window.addEventListener('scroll', fixNav);

</script>

</body>
Expand Down
13 changes: 0 additions & 13 deletions 24 - Sticky Nav/style-START.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ body {
transition: transform 0.5s;
}

.fixed-nav .site-wrap {
transform: scale(1);
}

header {
text-align: center;
height:50vh;
Expand All @@ -52,11 +48,6 @@ nav {
z-index: 1;
}

.fixed-nav nav {
position: fixed;
box-shadow: 0 5px rgba(0,0,0,0.1)
}

nav ul {
margin: 0;
padding:0;
Expand All @@ -81,10 +72,6 @@ li.logo {
font-size: 30px;
}

.fixed-nav li.logo {
max-width:500px;
}

li.logo a {
color:black;
}
Expand Down