Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kReEsTaL/7222348 to your computer and use it in GitHub Desktop.
Save kReEsTaL/7222348 to your computer and use it in GitHub Desktop.
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