2013-09-23 2 views
2

Apple 새로운 iOS7 운영 체제로 인해 망막 미디어 쿼리에 문제가 발생했습니다.iOS7 미디어 쿼리 (망막 배경 크기)

이미지 교체는 iOS6 이하를 실행하는 iPhone 4, 4s, 5 (모든 브라우저)에서 완벽하게 작동합니다. iOS7 브라우저는 고해상도 이미지를 가로 채지 만 배경 크기 속성은 무시합니다.

"(최소 장치 - 픽셀 비율 : 2)"로 시도했지만 응용 프로그램이 우리의 비 망막 스프라이트를 보여주기 때문에 작동하지 않습니다. 누구든지 해결할 생각이 있습니까?

@mixin sprite($x,$y, $spriteX: 32, $spriteY: 32, $imagePath: "sprites.png"){ 
    @include spriteHelper($imagePath, $x, $y, $spriteX, $spriteY); 
    @media (-webkit-min-device-pixel-ratio: 2) and (min-device-pixel-ratio: 2) 
    { 
     $imagePath: "spritesx2.png"; 
     background-size: 500px 1760px; 
     @include spriteHelper($imagePath, $x, $y, $spriteX, $spriteY); 
    } 
} 
+1

접두사와 접두사가없는 픽셀 사이의 '및'이 홀수입니다. '@media only screen and (-webkit-min-device-pixel-ratio : 2), 스크린 만 (min-device-pixel-ratio : 2) {...}'이 아니겠습니까? –

+0

@PaulRoub, 절대적으로 - http://css-tricks.com/snippets/css/retina-display-media-query/ –

답변

2

감사합니다. 배경 크기의 "! important"태그로 고치기

@mixin sprite($x,$y, $spriteX: 32, $spriteY: 32, $imagePath: "sprites.png"){ 
    @include spriteHelper($imagePath, $x, $y, $spriteX, $spriteY); 
    @media 
    only screen and (-webkit-min-device-pixel-ratio: 2), 
    only screen and (-moz-min-device-pixel-ratio: 2), 
    only screen and (-o-min-device-pixel-ratio: 2/1), 
    only screen and (min-device-pixel-ratio: 2), 
    only screen and (min-resolution: 2dppx) 
    { 
     $imagePath: "spritesx2.png"; 
     background-size: 500px 1800px !important; 
     @include spriteHelper($imagePath, $x, $y, $spriteX, $spriteY); 
    } 
} 
+0

나에게 약간의 고통, 구했어! – joemaller