Skip to content

Instantly share code, notes, and snippets.

@yjsoon
Last active December 11, 2015 23:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yjsoon/4680182 to your computer and use it in GitHub Desktop.
Save yjsoon/4680182 to your computer and use it in GitHub Desktop.
Using Compass sprites for hover-state social icons
// Where the social icons are in a 'social' subfolder in the images folder
// And the naming convention is footer-<servicename>.png / footer-<servicename>-active.png
@import "compass/utilities/sprites";
$social-sprite-map: sprite-map('social/*.png');
@mixin active-social($name) {
@include sprite-replace-text-with-dimensions($social-sprite-map, footer-#{$name});
&:hover {
@include sprite-replace-text-with-dimensions($social-sprite-map, footer-#{$name}-active);
}
}
.footer-twitter {
@include active-social(twitter);
}
.footer-facebook {
@include active-social(facebook);
}
.footer-gplus {
@include active-social(gplus);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment