2012-06-23 60 views
0

我有一個頁面內置jQuery Mobile,我試圖用CSS來插入背景,但這裏已經有了這個灰色的背景。jQuery手機後臺

我該如何擺脫它?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, target-densityDpi=device-dpi" /> 
<title>GeoBird</title> 
<link href="jquery-mobile/jquery.mobile.theme-1.0.min.css" rel="stylesheet" type="text/css" /> 
<link href="jquery-mobile/jquery.mobile.structure-1.0.min.css" rel="stylesheet" type="text/css" /> 
<script src="jquery-mobile/jquery-1.6.4.min.js" type="text/javascript"></script> 
<script src="jquery-mobile/jquery.mobile-1.0.min.js" type="text/javascript"></script> 
<script type="text/javascript" charset="utf-8" src="phonegap.js"></script> 
</head> 
<body> 
<div data-role="page" id="home"> 
    <div data-role="header"> 
    <h1>SketchUp</h1> 
    </div> 

<style> 
#buttons { 
position: absolute; 
top: 200px; 
left: 175px;} 

body { 
    background: url(background.jpg); 
    background-repeat:repeat-y; 
    background-position:center center; 
    background-attachment:scroll; 
    background-size:100% 100%; 
} 
</style> 



<script language="javascript" type="text/javascript"> 
$(document).ready(function() { 
    $("#quitbutton").click(function() { 
     alert("clicked"); 
     navigator.app.exitApp(); 
    }); 
}); 
    </script> 






<div id="buttons"> 
<a href="game.html" data-role="button" data-iconpos="bottom">Start</a> 
<a href="" data-role="button" data-iconpos="bottom">Options</a> 
    <a href="" data-role="button" data-iconpos="bottom">Credits</a> 
    <a id="quitbutton" data-role="button" data-iconpos="bottom">Quit</a> 
    </div> 
</body> 
</html>​ 
+0

你在說什麼灰色背景。 – SVS

+0

請修復你的jsfiddle。您不能在jsfiddle中使用相對路徑,因爲它會鏈接到jsfiddle.net本身的文件。請以絕對路徑重新發布。 –

回答

0

在JSfiddle中,由於路徑問題,它沒有獲取背景圖片。請檢查圖片路徑在CSS中是否正確。

我試圖從谷歌圖片添加背景圖片,它正常工作。

<style> 
body { 
     background: url('http://colorvisiontesting.com/plate%20with%205.jpg'); 
    background-repeat:repeat-y; 
    background-position:center center; 
    background-attachment:scroll; 
    background-size:100% 100%; 
    } 
</style> 

它工作正常。所以請檢查一次你的圖像路徑是否正確。

謝謝

+0

我在測試你的答案,1秒 – Excalibur

+0

你得到了什麼結果......我希望它能起作用。並請在圖像的網址有不必要的空間,所以刪除,在我的答案.. –

+0

對不起,不工作,我也修復了路徑 – Excalibur