Last active
December 26, 2015 22:19
-
-
Save kReEsTaL/7222348 to your computer and use it in GitHub Desktop.
Get background-position from Compass magic sprites in em
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
/** | |
* @subsection Get Sprites position in EM | |
* @author Marie Guillaumet | |
*/ | |
@mixin em-sprite-position($map, $sprite, $context: $fs, $offset-x: 0, $offset-y: 0) | |
{ | |
/** Thank you @pioupiouM! */ | |
$position: sprite-position($map, $sprite, $offset-x, $offset-x); | |
$x: nth($position, 1); | |
$y: nth($position, 2); | |
@if "%" == unit($offset-x) | |
{ | |
background-position: $offset-x em($y,$context); | |
} | |
@else if "%" == unit($offset-y) | |
{ | |
background-position: em($x,$context) $offset-y; | |
} | |
@else | |
{ | |
background-position: em($x,$context) em($y,$context); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment