Last active
December 20, 2015 10:19
-
-
Save stefthoen/6114144 to your computer and use it in GitHub Desktop.
Sass mixin for retina images.
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
@mixin at2x($image_name, $w: auto, $h: auto, $extention: '.png') { | |
background-image: image-url($image_name + $extention); | |
$x2img : $image_name + '@2x' + $extention; | |
@media screen and (-webkit-min-device-pixel-ratio : 1.5) { | |
background-image: image-url($x2img); | |
background-size: $w $h; | |
} | |
} | |
// Roep aan met deze include: | |
@include at2x('logo', 270px, 67px); | |
// Als je ander formaat dan png wilt includen, dan moet je een extra extensie parameter meegeven: | |
@include at2x('logo', 270px, 67px, '.jpg'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment