I am building a jQuery mobile site, and I am trying to insert a scalable image into the background, which would adjust to screen size of the phone. This is my code:
With JQM 1.4.2 this one works for me (Change theme to the used one):
.ui-page-theme-b, .ui-page-theme-b .ui-panel-wrapper {
background: transparent url(../img/xxx) !important;
background-repeat:repeat !important;
}
For jquery mobile and phonegap this is the correct code:
<style type="text/css">
body {
background: url(imgage.gif);
background-repeat:repeat-y;
background-position:center center;
background-attachment:scroll;
background-size:100% 100%;
}
.ui-page {
background: transparent;
}
.ui-content{
background: transparent;
}
</style>
I found this answer works for me
<style type="text/css">
#background{
position: fixed;
top: 0;
left: 0;
width: 100% !important;
height: 100% !important;
background: url(mobile-images/limo-service.jpg) no-repeat center center fixed !important;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
z-index: -1;
}
.ui-page{
background:none;
}
</style>
also add id="background"
to the div for your content section
<div data-role="page" data-theme="a">
<div data-role="main" class="ui-content" id="background">
</div>
</div>
Try this. This should work:
<div data-role="page" id="page" style="background-image: url('#URL'); background-attachment: fixed; background-repeat: no-repeat; background-size: 100% 100%;"
data-theme="a">
None of the above worked for me using JQM 1.2.0
This did work for me:
.ui-page.ui-body-c {
background: url(bg.png);
background-repeat:no-repeat;
background-position:center center;
background-size:cover;
}
Override ui-page class in your css:
.ui-page {
background: url("image.gif");
background-repeat: repeat;
}