Skip to content

Instantly share code, notes, and snippets.

@juanbrujo
Created February 11, 2014 14:51
Show Gist options
  • Save juanbrujo/8936257 to your computer and use it in GitHub Desktop.
Save juanbrujo/8936257 to your computer and use it in GitHub Desktop.
A Pen by Jorge Epuñan.
nav
a(href="#") uno
a(href="#" class="current") dos
a(href="#") tres
span
var $btn = $('nav a');
var $class = 'current';
var $pointer = $('nav span');
if($btn.length) {
$btn.on('click', function(e){
e.preventDefault();
$btn.removeClass($class);
$(this).addClass($class);
});
}
@base: 500px;
@primarycolor: #e74c3c;
@secondarycolor: #c0392b;
@textcolor: #ecf0f1;
@strongcolor: #9b59b6;
body {
background-color: @primarycolor;
}
nav {
margin: 50px auto;
width: @base;
height: @base/6;
position: relative;
overflow: hidden;
font-size: 24px;
a {
display: inline-block;
width: 33%;
text-align: center;
height: @base/6;
line-height: @base/6;
color: @textcolor;
font-weight: bold;
text-decoration: none;
text-transform: uppercase;
text-shadow: @primarycolor 1px 1px 1px;
background-color: @secondarycolor;
transition: .3s;
&:hover,
&.current{
color: @strongcolor;
text-shadow: none;
background-color: white;
}
&.current {
&:nth-of-type(1) ~ span {
left: 0%
}
&:nth-of-type(2) ~ span {
left: 33%
}
&:nth-of-type(3) ~ span {
left: 66%
}
}
}
span {
width: 33%;
height: @base/100;
display: block;
position: absolute;
top: 0;
left: -33%;
background-color: @strongcolor;
transition: left .3s;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment