0

嗨,我目前正在开发这个网站:

http://remedia-solutions.com/clientes/0039_kiplingmexico/demo2/

实际上它在 Mac 和 PC 浏览器上完美运行,这里的问题是当我进入 Safari Ipad 时,一些背景图像根本不显示,而其他的则存在比例问题。

所以我会向你展示我目前的 CSS,看看我是否能得到任何帮助,因为我是 Ipad 上的新手。

这是我用于 IPAD 的 css(PC 和 mac 有另一个 css):

#fondo1{
    background-image: url("images/imagesbackground/BACKGROUND-INICIO.jpg");
    background-position: top center; 
    background-repeat: no-repeat;
    background-size: 1440px 950px;
    -webkit-background-size: 1440px 950px;
    position: absolute;
    width: 100%;
    height: 100%;
    display: block; 
}
#fondo1int{
    background-image: url("images/INICIO.png");
    background-position: center center; 
    background-repeat: no-repeat;
    background-size: 50%;
    -moz-background-size: 50%;
    position: absolute;
    width: 100%;
    height: 100%; 
    display: block; 
    top: 0;
    left: 0;
}

#fondo2{
    background-image: url("images/imagesbackground/BACKGROUND-HISTORIA.jpg");
    background-position: top center; 
    background-repeat: no-repeat;
    background-size: 1440px 950px;
    -moz-background-size: 1440px 950px;
    -webkit-background-size: 1440px 950px;
    position: absolute;
    width: 100%;
    height: 100%; 
}

#fondo2int{
    background-image: url("images/BACKGTOUND-TEXTO-HISTORIA.png");
    background-position: center center; 
    background-repeat: no-repeat;
    background-size: 50%;
    -moz-background-size: 50%;
    position: absolute;
    width: 100%;
    height: 100%; 
}

这是我的 jquery 来计算窗口的高度和宽度:

$("#todoini,#todohistoria , #todocoleccion , #todocuidados, #todosucursales,#todocontacto").css('height', $(window).height());
$("#todoini, #todohistoria , #todocoleccion , #todocuidados, #todosucursales,#todocontacto").css('width', $(window).width());
$("#navimage").css('margin-left', $(window).width() / 2 - 140);
$("#navimage").css('margin-top', $(window).height() -140);
$("#contenidoimagen , #contenidoimagen2 , #contenidoimagen3 , #contenidoimagen4, #contenidoimagen5,#contenidoimagen6").css('width', $(window).width());
$("#contenidoimagen, #contenidoimagen2 ,#contenidoimagen3 , #contenidoimagen4 , #contenidoimagen5,#contenidoimagen6").css('height', $(window).height());
$("#todo").css('width', $("#todoini").width() + $("#todohistoria").width() + $("#todocoleccion").width() + $("#todocuidados").width() + $("#todosucursales").width() + $("#todocontacto").width());
$("#todoini , #todohistoria, #todocoleccion, #todocuidados, #todosucursales, #todocontacto").css('float', 'left');
$(window).resize(function() {
    $("#todoini,#todohistoria , #todocoleccion , #todocuidados, #todosucursales, #todocontacto ").css('height', $(window).height());
    $("#todoini,#todohistoria , #todocoleccion , #todocuidados, #todosucursales, #todocontacto").css('width', $(window).width());
    $("#contenidoimagen , #contenidoimagen2 , #contenidoimagen3 , #contenidoimagen4, #contenidoimagen5 , #contenidoimagen6").css('width', $(window).width());
    $("#todo").css('width', $("#todoini").width() + $("#todohistoria").width() + $("#todocoleccion").width() + $("#todocuidados").width() + $("#todosucursales").width() + $("#todocontacto").width());
});
$(window).trigger('resize')

所以背景容器总是有一个宽度和一个高度设置。

有任何想法吗?

如果我使用背景大小,请快速编辑:覆盖它确实显示但图像很大:/

4

1 回答 1

0

解决方案是为每个背景设置宽度和高度。

#fondo1{
    background:  url("images/imagesbackground/BACKGROUND-INICIO.jpg");
    background-position:    top center;
    background-repeat:      no-repeat;
    -webkit-background-size:    1024px 768px !important;
    position:absolute;
    width:1024px !important;
    height:768px !important;



}
#fondo1int{
    background-image: url("images/INICIO-OTONO.png") !important;
    background-position:    center center;
    background-attachment: initial; 
    background-repeat:      no-repeat;
    background-size:    800px 400px !important;
    position:absolute;
    width:1024px !important;
    height:768px !important;



}
于 2012-08-16T21:16:59.700 回答