I am doing a iPhone app using Phonegap & also using jquery mobile. I want to set background image for data-role=page div. In this height of page is equal to screen & hence background is set to size of screen. But the page content length is much greater than screen & hence gray background is seen after image completes. My question is whether there is a way so that we can keep the background image fixed & scroll or move only content of page & not background image. Just to mention I have tried full size background jquery pluggin. Its working on Android but not on iOS.
Can anyone please help? Thanks in advance.
you can try this:
works fine for me.
Ok, so what I did instead was to create a fixed element within the body element of the page. So it would look like
And for the CSS I stated the following:
And this did the trick for me. Hopefully it helps (someone out there :P)
You can set your background image to the jQuery page:
You looking for css
background-attachment
property.Update:
background-attachment:fixed
is supported from iOS 5, if you using older version of iOS you may consider usage ofiScroll
.css:
The problem is that iOS mobile devices have errors rendering simultaneously
background-size:cover;
andbackground-attachment:fixed;
so you have to fix it by@media
Try with this, this work for me.