【问题标题】:Background images not rendering correctly and others dont appear on Ipad背景图像未正确渲染,其他图像未出现在 Ipad 上
【发布时间】:2012-08-01 17:24:26
【问题描述】:

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

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

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

所以我给你看一下我目前的 CSS,看看我是否能得到任何帮助,因为我是 Ipad 的新手。

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

#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')

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

有什么想法吗?

如果我使用背景大小,则快速编辑:封面确实显示,但图像很大:/

【问题讨论】:

    标签: jquery css ipad html ipad-2


    【解决方案1】:

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

    #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;
    
    
    
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-11-28
      • 1970-01-01
      • 2021-11-15
      • 2020-10-04
      • 1970-01-01
      • 2018-01-02
      • 1970-01-01
      相关资源
      最近更新 更多