Last active
August 29, 2015 14:05
-
-
Save juanbrujo/b1192a85c3f2932544fc to your computer and use it in GitHub Desktop.
Add a class to a <header> if it reaches certain value while scrolling
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script> | |
<meta charset="utf-8"> | |
<title>transformFixedNav()</title> | |
</head> | |
<body> | |
<header>header</header> | |
<div class="content"> | |
.content 1 | |
</div> | |
<div class="content"> | |
.content 2 | |
</div> | |
<div class="content"> | |
.content 3 | |
</div> | |
</body> | |
</html> |
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
header { | |
position: fixed; | |
width: 100%; | |
height: 100px; | |
background-color: pink; | |
z-index: 99; | |
-webkit-transition: .3s; | |
transition: .3s; | |
&.breakpoint { | |
height: 50px; | |
font-size: 10px; | |
} | |
} | |
.content { | |
position: relative; | |
width: 100%; | |
height: 100%; | |
background-color: gray; | |
border-bottom: 5px solid red; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment