Skip to content

Instantly share code, notes, and snippets.

@valerysntx
Created June 10, 2014 15:05
Show Gist options
  • Save valerysntx/00c80dcc1795fbcfbaeb to your computer and use it in GitHub Desktop.
Save valerysntx/00c80dcc1795fbcfbaeb to your computer and use it in GitHub Desktop.
anchor hover animation effect. http://jsbin.com/xaruj/70/
body {
font: 16px/1 sans-serif;
margin: 0;
background-color: #fefefe;
}
nav a {
font: 0/0 Tahoma;
text-align: center;
text-decoration: none;
display: block;
position: relative;
width: 4rem;
height: 4rem;
box-shadow: inset whitesmoke 2px 1px;
transition: all .6s ease-out;
right: 0px;
}
nav a::before {
color: black;
font: 2rem/4rem serif;
background-color: #ffe;
width: 4rem;
height: 4rem;
z-index: 99;
display: block;
position: absolute;
}
nav a[rel="prev"]::before {
content: ">";
font-weight: bolder;
font-size: -webkit-xxx-large;
}
nav a[rel="next"]::before {
content: "<";
font-weight: bolder;
font-size: -webkit-xxx-large;
}
nav a::after {
color: #fff;
font: 0.875rem/1.1429 sans-serif;
text-align: left;
white-space: pre-wrap;
background-color: rgba(0,0,0,0.75);
padding: 0.5rem 0.75rem;
top: 0;
bottom: 0;
right: 0;
width: 18rem;
z-index: 0;
display: block;
position: absolute;
transition: all .6s ease-out;
}
nav a[rel="prev"]::after {
content: attr(data-title);
}
nav a[rel="next"]::after {
content: attr(data-title);
}
nav a:hover::after {
right: -19.5rem;
}
nav a:hover {
right: 20px;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
</body>
<nav>
<a rel="prev" href="#" data-title="JavaScript: Taking Off the Training Wheels">Previous Article</a>
<a rel="next" href="#" data-title="Animating Vectors with SVG">Next Article</a>
</nav>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment