<div class="wraper">
<h1 class="main_vsual">٩('ω')و</h1>
<div class="nav_wrap">
<nav>
<ul>
<li>list</li>
<li>list</li>
<li>list</li>
<li>list</li>
</ul>
</nav>
</div>
<main>
<div><img src="http://placekitten.com/300/300"> </div>
<div><img src="http://placekitten.com/350/350"> </div>
<div><img src="http://placekitten.com/800/800"> </div>
<div><img src="http://placekitten.com/500/500"> </div>
<div><img src="http://placekitten.com/700/700"> </div>
</main>
<footer>٩( ᐛ)و</footer>
</div>
.main_vsual{
height: 150px;
margin: 0;
text-align: center;
background-color: tomato;
line-height: 150px;
color:white;
font-size: 50px;
}
.nav_wrap{
height: 50px;
}
.nav_wrap nav{
width: 100%;
height: 50px;
background-color: #5cb531;
}
.nav_wrap nav.fixed{
position: fixed;
top: 0;
left: 0;
}
.nav_wrap nav ul{
display: table;
width: 100%;
height: 100%;
}
.nav_wrap nav ul li{
display: table-cell;
vertical-align: middle;
text-align: center;
color: white;
font-size: 18px;
border: 1px solid #fff;
}
main{
height: 1500px;
text-align: center;
}
main div img{
width: 300px;
height: 300px;
vertical-align: top;
}
footer{
height: 50px;
background-color: tomato;
text-align: center;
color: white;
line-height: 50px;
}
var nav = $('.nav_wrap > nav'),
offset = nav.offset();
$(window).scroll(function () {
if($(window).scrollTop() > offset.top) {
nav.addClass('fixed');
} else {
nav.removeClass('fixed');
}
});
This Pen doesn't use any external CSS resources.