Last active
December 11, 2015 23:58
-
-
Save yjsoon/4680182 to your computer and use it in GitHub Desktop.
Using Compass sprites for hover-state social icons
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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