Created
July 9, 2014 05:27
-
-
Save ezos86/422ec3531656e1c5cfe6 to your computer and use it in GitHub Desktop.
A Pen by ezos86.
This file contains hidden or 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
<nav class="navigation"> | |
<ul> | |
<li><a href="#section-1">Section 1</a></li> | |
<li><a href="#section-2">Section 2</a></li> | |
<li><a href="#section-3">Section 3</a></li> | |
</nav> | |
<div id="section-1"> | |
<h1 style="text-align:center;font-size:70px; font-family:Helvetica;"> | |
Section 1 | |
</h1> | |
</div> | |
<div id="section-2"> | |
<h1 style="text-align:center;font-size:70px; font-family:Helvetica;"> | |
Section 2 | |
</h1> | |
</div> | |
<div id="section-3"> | |
<h1 style="text-align:center;font-size:70px; font-family:Helvetica;"> | |
Section 3 | |
</h1> | |
</div> |
This file contains hidden or 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
$(function() { | |
$('a[href*=#]:not([href=#])').click(function() { | |
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) { | |
var target = $(this.hash); | |
target = target.length ? target : $('[name=' + this.hash.slice(1) +']'); | |
if (target.length) { | |
$('html,body').animate({ | |
scrollTop: target.offset().top | |
}, 1000); | |
return false; | |
} | |
} | |
}); | |
}); |
This file contains hidden or 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
#section-1, #section-2, #section-3{ | |
min-height:600px; | |
background-color:#ccc; | |
border-top:3px solid #fff; | |
} | |
nav.navigation{ | |
background-color:#333; | |
width:100%; | |
position:fixed; | |
top:0; | |
} | |
nav.navigation ul{ | |
margin:0; | |
} | |
nav.navigation ul li{ | |
display:inline-block; | |
list-style:none; | |
padding:10px; | |
position:relative; | |
} | |
nav.navigation ul li a{ | |
color:#f1f1f1; | |
text-decoration:none; | |
padding:10px; | |
} | |
nav.navigation ul li a:hover{ | |
background-color:#888; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment