aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanny Keane <[email protected]>2013-02-11 18:23:21 -0800
committerDanny Keane <[email protected]>2013-02-11 18:23:21 -0800
commite8dc036d2522d586ae657d6102da0261c78e7e64 (patch)
tree3ea093cd8c249abf7b8d509b7f63fb1199214704
parent1dda3c395a338e1342f7c4bfcdc708b525d22e1d (diff)
downloadbootstrap-e8dc036d2522d586ae657d6102da0261c78e7e64.tar.xz
bootstrap-e8dc036d2522d586ae657d6102da0261c78e7e64.zip
Added retina image support mixin
-rw-r--r--less/mixins.less26
1 files changed, 26 insertions, 0 deletions
diff --git a/less/mixins.less b/less/mixins.less
index ad1597121..b2116ce56 100644
--- a/less/mixins.less
+++ b/less/mixins.less
@@ -374,6 +374,32 @@
}
+// RETINA IMAGE SUPPORT
+// --------------------------------------------------
+
+// Retina background image support with non-retina fall back
+// Usage example can be found here: https://gist.github.com/dannykeane/4754113
+.retina-image(@file, @type, @repeat, @width, @height, @posx, @posy) {
+ background-image: url('@{file}.@{type}');
+ background-repeat: @repeat;
+ background-position: @posx @posy;
+
+ @media print,
+ screen,
+ (-webkit-min-device-pixel-ratio: 1.25),
+ (~`"-o-min-device-pixel-ratio: 1.25/1"`),
+ (min--moz-device-pixel-ratio: 1.25),
+ (-moz-min-device-pixel-ratio: 1.25),
+ (-ms-min-device-pixel-ratio: 1.25),
+ (min-device-pixel-ratio: 1.25),
+ (min-resolution: 120dpi),
+ (min-resolution: 1.25dppx) {
+ background-size: @width @height;
+ background-image: url('@{file}@2x.@{type}');
+ background-position: @posx * 2 @posy * 2;
+ }
+}
+
// COMPONENT MIXINS
// --------------------------------------------------