나는 나의 아이폰 CSS 멋지게 연주하려고 노력 포기하고, jQuery를 사용에 의존해야했다. 그런 다음
<body>
<div class="cssFullScreen" />
...etc...
내가 CSS의 두 큰술에 추가 ...
<style>
.cssFullScreen
{
position: absolute;
left:0px;
top:0px;
background: url(BackgroundImage.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
</style>
.. 그리고 마지 못해 내 웹 페이지에서
, 나는 내가 화면을 채우려 <div>
추가 jQuery의 특종 ...
<script src="jquery-2.2.3.min.js"></script>
<script type="text/javascript">
$().ready(function() {
ResizeWindows();
$(window).resize(function() {
ResizeWindows();
});
});
function ResizeWindows() {
// When the user resizes the window, we'll resize any DOM elements
// with the "cssFullScreen" class.
var width = window.innerWidth ? window.innerWidth : $(window).width();
var height = window.innerHeight ? window.innerHeight : $(window).height();
$(".cssFullScreen").width(width);
$(".cssFullScreen").height(height);
}
</script>
정말 좋지는 않지만 실제로 발견 할 수있는 유일한 것입니다. 아이폰에서 일했다.
이상하게도이 코드는 div
에 적용했을 때 iPhone에서만 작동했습니다. 내가 html
또는 body
에 직접 적용하려고하면 아무 것도하지 않았습니다 ...
나는 당신의 질문이 여기에 논의되었다고 생각합니다. >> http://stackoverflow.com/questions/9779195/does-a-background-attachment -of-fixed-work-in-ios5 – SULTAN