Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Get background-position from Compass magic sprites in em
/**
* @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
You can’t perform that action at this time.