简体   繁体   English

在jQM中,为Page设置全屏CSS图像背景的正确/正确/实际方法是什么?

[英]In jQM, what is the proper/correct/actual way to set fullscreen CSS image background for Page?

After a long time working on a jQM project, almost complete in functionality. 经过长时间的jQM项目工作,功能几乎完成。 Now working on UI. 现在在UI上工作。 When I try to set full cover CSS image background for jQM Page, it either doesn't work as expected. 当我尝试为jQM Page设置全封面CSS图像背景时,它要么无法正常工作。

I google/stackoverflow a lot on this matter. 我在这个问题上google / stackoverflow很多。 To my surprise, there is no official documentation, direct/simple way to solve this problem. 令我惊讶的是,没有官方文档可以直接/简单地解决此问题。

Many suggestion will work for some people and not for others (even all in supported browser). 许多建议仅对某些人有用,而对其他人则不行(即使是所有受支持的浏览器)。 For me, at first I can't get the 100% height, then after some google and help from other programmer, I can get the 100% height but now its bouncing background before and after transition. 对我来说,起初我无法获得100%的高度,然后在经过google和其他程序员的帮助之后,我可以获得100%的高度,但是现在它在过渡前后的反弹背景。

The question for this post, is there any correct way/proper way, official way to set jQM Page background image WITHOUT all the PROBLEMs? 这个帖子的问题是,有没有正确的方法/正确的方法来设置没有所有问题的jQM页面背景图像的正式方法?

I'm sure this correct/proper/actual way can help and benefits many other developers. 我确信这种正确/正确/实际的方式可以帮助许多其他开发人员并从中受益。

Please advice, thank you. 请指教,谢谢。

Working example: http://jsfiddle.net/Gajotres/vds2U/51/ 工作示例: http : //jsfiddle.net/Gajotres/vds2U/51/

Content background image 内容背景图片

HTML HTML

<div data-role="page" id="index" data-theme="a" >
    <div data-role="header">
        <h3>
            First Page
        </h3>
        <a href="#second" class="ui-btn-right">Next</a>
    </div>

    <div data-role="content" id="content">

    </div>

    <div data-role="footer" data-position="fixed">

    </div>
</div>  

CSS CSS

#content {
    padding: 0;
    position: absolute !important;
    top : 40px !important; 
    right : 0;
    bottom : 0 !important; 
    left : 0 !important;  
    background:url(http://htc-wallpaper.com/wp-content/uploads/2013/11/bulldog-puppy1.jpg);
    background-size:cover;
    background-repeat:no-repeat;    
}

Read more about this solution here . 在此处阅读有关此解决方案的更多信息。

Page background image 页面背景图片

CSS CSS

.ui-page {
    background:url(http://htc-wallpaper.com/wp-content/uploads/2013/11/bulldog-puppy1.jpg);
    background-size:cover;
    background-repeat:no-repeat;    
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM