Created
December 10, 2014 01:36
-
-
Save jaredkc/3d701e7c66fc51269adf to your computer and use it in GitHub Desktop.
Sass Retina Sprite Mixin
This file contains hidden or 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
| // -------------------------------------------------- | |
| // Sprite along with retina version. | |
| // -------------------------------------------------- | |
| @mixin sprite($xpos, $ypos, $width: 600px, $height: 600px) { | |
| background-image: url(../img/sprite.png); | |
| background-position: $xpos $ypos; | |
| background-repeat: no-repeat; | |
| // Solution for retina graphics. | |
| // Variation of: http://37signals.com/svn/posts/3271-easy-retina-ready-images-using-scss | |
| @media (min--moz-device-pixel-ratio: 1.3), | |
| (-o-min-device-pixel-ratio: 2.6/2), | |
| (-webkit-min-device-pixel-ratio: 1.3), | |
| (min-device-pixel-ratio: 1.3), | |
| (min-resolution: 1.3dppx) { | |
| & { | |
| background-image: url(../img/[email protected]); | |
| -webkit-background-size: $width $height; | |
| background-size: $width $height; | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment