Skip to content

Instantly share code, notes, and snippets.

@psflannery
Created September 30, 2013 20:12
Show Gist options
  • Save psflannery/6769460 to your computer and use it in GitHub Desktop.
Save psflannery/6769460 to your computer and use it in GitHub Desktop.
/*
<a href="#" class="arrow">Arrow</a>
*/
.arrow {
display: inline-block;
position: relative;
text-indent: -9999px;
width: 36px;
height: 36px;
background: url(sprites.png) no-repeat;
}
.arrow:after {
content: "";
position: absolute;
top: 0; left: 0; bottom: 0; right: 0;
background: url(sprites.png) no-repeat;
background-position: -50px 0;
opacity: 0;
-webkit-transition: opacity 0.5s;
-moz-transition: opacity 0.5s;
-o-transition: opacity 0.5s;
}
.arrow:hover:after {
opacity: 1;
}
//<a href="#" class="arrow">Arrow<span></span></a>
/*
.arrow {
display: inline-block;
position: relative;
text-indent: -9999px;
width: 36px;
height: 36px;
background: url(sprites.png) no-repeat;
}
.arrow span {
position: absolute;
top: 0; left: 0; bottom: 0; right: 0;
background: url(sprites.png) no-repeat;
background-position: -50px 0;
}
*/
$(function() {
$(".arrow")
.find("span")
.hide()
.end()
.hover(function() {
$(this).find("span").stop(true, true).fadeIn();
}, function() {
$(this).find("span").stop(true, true).fadeOut();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment