<div class="wrapper">
<div>
<h1>Dynamic <span>Navigation</span></h1>
</div>
<div class="controls noPrev">
<div class="left">
<a href="#" class="prev"><i class="fa fa-chevron-left"></i></a>
</div>
<div class="right">
<div class="nextContainer">
<div class="page">
<span class="current" data-current="1">1</span>
of
<span class="total" data-total="4">4</span>
</div>
<a href="#" class="next"><i class="fa fa-chevron-right"></i></a>
</div>
</div>
</div>
</div>
@import url(https://fonts.googleapis.com/css?family=Lato:300|Gentium+Book+Basic:400italic|Open+Sans:700);
html {
background: #000;
height: 100%;
}
.wrapper {
display: none;
user-select: none;
position: fixed;
top:0;left:0;right:0;bottom:0;
background: #000 url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/173626/bg.jpg);
box-shadow:inset 0 0 100px 0 #151619;
}
h1 {
font-family: 'Gentium Book Basic', serif;
font-style: italic;
font-size: 40px;
color: #000;
text-align: center;
padding: 50px 0 0;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
font-weight: 100;
margin-bottom: 50px;
}
h1 span {
font-family: 'Open Sans', sans-serif;
font-style: normal;
color: #01DBFE;
text-shadow: 3px 1px 5px #101010;
}
.controls * {
margin: 0;
box-sizing: border-box;
}
.controls {
width: 165px;
margin: 0 auto;
position: relative;
font-family: 'Lato', sans-serif;
color: #BDF8FF;
transition: all 0.3s ease;
}
.controls .left,
.controls .right {
position: absolute;
}
.controls .right {
left: 40px;
}
.controls a {
width: 34px;
height: 34px;
border: 3px solid #000;
border-radius: 35px;
font-size: 14px;
color: #BDF8FF;
box-shadow: inset 0 1px 2px 0 #585858, inset 0 1px 1px 0 #4E4F53;
}
.controls a:hover {
box-shadow: 0 1px 2px 0 #525252, inset 0 1px 1px 0 #4E4F53;
box-shadow: 0 1px 2px 0 #525252, inset 0 2px 5px 0 #252525;
color:#8DCAD1;
}
.controls .prev {
float: left;
}
.controls .next {
float: right;
}
.controls i {
position: relative;
text-shadow: 0 1px 4px #86C4F9;
top: 5px;
}
.controls .prev i {
left: 8px;
}
.controls .next i {
left: 11px;
}
.controls .page {
height: 35px;
margin: 0 5px 0 0;
font-size: 14px;
font-weight: bold;
line-height: 30px;
text-align: center;
width: 85px;
float: left;
border: 3px solid #000;
border-radius: 35px;
box-shadow: inset 0 1px 2px 0 #585858, inset 0 1px 1px 0 #4E4F53;
text-shadow: 0 1px 3px #86C4F9;
overflow: hidden;
}
.controls.noPrev .prev,
.controls.noNext .next {
color: #000;
pointer-events: none;
box-shadow: 0 1px 2px 0 #585858, inset 0 1px 10px 4px #222;
}
.controls.noPrev .prev i,
.controls.noNext .prev i{
text-shadow: 0 1px 4px #3A3A3A;
top: 6px;
}
.controls .next {
transition: all 0.3s ease;
}
.controls.morph .next {
border-color: #000;
background-color: rgba(0, 0, 0, 0);
color: #BDF8FF;
width: 125px;
line-height: 26px;
text-shadow: 0px 1px 4px #86C4F9;
}
.controls .page {
transition: all 0.3s ease;
}
.controls.morph .page {
width: 0px;
margin: 0px;
transform: scale(0);
border-width: 0px;
}
.controls.morph .next:before,
.controls.morph .next::before {
content: 'Continue';
position: absolute;
left: 18px;
animation: displayContinue 0.3s forwards;
animation-delay: 0.3s;
font-size: 12px;
letter-spacing: 0.7px;
text-transform: uppercase;
line-height: 28px;
opacity:0;
}
.ie9 .controls.morph .next::before {
opacity: 1;
}
@keyframes displayContinue {
100% {
opacity: 1;
}
}
.controls.morph .next i {
right: 10px;
left: auto;
position: absolute;
top: 10px;
}
.controls.morph.disabled .next {
pointer-events: none;
background-color: #f0f0f0;
border-color: #f0f0f0;
}
(function($){
$(window).load(function(){
$('.wrapper').fadeIn();
});
var ctrl = $('.controls'),
t = $('.total', ctrl).attr('data-total'),
c = $('.current', ctrl),
n = c.attr('data-current');
$('.next', ctrl).on('click', function(e){
e.preventDefault();
ctrl.removeClass('noPrev');
(n + 1 >= t) ? ( n = t,ctrl.addClass('morph') ) : n++;
c.attr('data-current', n).html(n);
});
$('.prev', ctrl).on('click', function(e){
e.preventDefault();
ctrl.removeClass('morph');
(n - 1 <= 1) ? (n = 1, ctrl.addClass('noPrev') ) : n-- ;
c.attr('data-current', n).html(n);
});
})(jQuery);