2014-02-28 19 views
1

在我的jQuery手机1.4.0应用程序,我有一个页面,其中包含一个列表视图问题是,当我为这个页面添加一个背景图像,因为列表元素变得越来越大,随着背景拉伸与内容和这个apears显然在移动设备上超过jsFiddle,这是我的jsfiddle如何防止页面背景图像在jQuery Mobile 1.4.0中伸缩?

如何使背景图像成为全屏并固定,而不是与内容拉伸?请帮我..

在这里,我如何添加背景图片到我的网页:

#EmPListPage{ 
    background-image: url('http://images2.layoutsparks.com/1/218610/just-ducky-dots- pinky.gif') !important; 
    background-repeat: no-repeat; 
    background-size: 100% 100%; 
} 

#PageContent{ 

    background: transparent ;  
} 
+0

添加背景图片本身的页面优于内容DIV或任何其他股利。 – Omar

+0

@OmarI我已经将页面背景图片添加到页面检查jsfiddle,这个#EmPListPage:是我的页面ID – user

+0

@OmarDo你对这个问题有什么想法吗?我怎样才能解决它,请你能帮助我吗? – user

回答

0

你会想背景图片添加到文档body,而不是你的div容器。在小提琴使用你的CSS:

body { 
    background-image: url('http://images2.layoutsparks.com/1/218610/just-ducky-dots-pinky.gif') !important; 
    background-repeat: no-repeat; 
    background-size: 100% 100%; 
} 

#EmPListPage, #PageContent{  
    background: transparent ;  
} 

小提琴:http://jsfiddle.net/chucknelson/6zKJg/

+0

我已经尝试过,但它根本无法在jQuery移动1.4.0的背景图像没有出现 – user

+0

@user不知道如果你在问题的评论中解决了它,但我添加了一个小提琴(基于你的最新版本)来证明这个答案似乎在正常情况下工作。也许在你的实际代码中有独特的问题,不确定。 – chucknelson

1

在我的情况的解决方案是使用contain,像这样:

.ui-page { 
    background: #000; 
    background-image: url("http://bettingmasters.info/wp-content/uploads/2013/11/19757-football-stadium-1920x1200-sport-wallpaper.jpg"); 
    background-size: contain; 
}