2013-01-14 98 views
1

我在跟隨Sams教你自己在24小時內使用jquery mobile。但下面的代碼不起作用。JQuery Mobile對話框不能打開

我試圖調試JavaScript,但沒有JavaScript。如果有一種方法來調試jquery mobile會很好。 Isuru的[R é總和é

<meta name="viewport" content="width=device-width, initial-scale=1"> 

    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" /> 
    <script src="http://code.jquery.com/jquery-1.8.2.min.js"></script> 
    <script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script> 
</head> 
<body> 
    <div data-role="page"> 
     <div data-role="header"> 
      <h1>Isuru's R&#233;sum&#233;</h1> 
     </div> 

     <div data-role="content"> 
      <p>I'm a Mobile Developer with experience in web and android mobile app development. 
       My skills include HTML, CSS, Python, WAMP Development and Java. 
       I also have experience with SEO and Internet Advertising.</p> 
      <a href="#contact" data-role="button" data-rel="dialog">Contact me!</a> 
     </div> 

     <div data-role="page" id="contact" data-theme="c"> 
      <div data-role="header"><h1>Clicked!</h1></div> 
      <div data-role="content"> 
       <p>Clicked content!</p> 
       <a href="#contact" data-rel="back" data-role="button">Go back</a> 
      </div> 
     </div> 

    </div> 

</body> 
</html> 

回答

1

你有幾個錯誤。

這裏有一個工作示例:

<!DOCTYPE html> 
<html> 
<head> 
    <title>jQM Complex Demo</title> 
    <meta name="viewport" content="width=device-width"> 
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" /> 
    <script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>  
</head> 
<body> 
    <div data-role="page" id="index"> 
     <div data-role="header"> 
      <h1>Isuru's R&#233;sum&#233;</h1> 
     </div> 

     <div data-role="content"> 
      <p>I'm a Mobile Developer with experience in web and android mobile app development. 
       My skills include HTML, CSS, Python, WAMP Development and Java. 
       I also have experience with SEO and Internet Advertising.</p> 
      <a href="#contact" data-role="button" data-rel="dialog">Contact me!</a> 
     </div> 
    </div> 

    <div data-role="dialog" id="contact" data-theme="c"> 
    <div data-role="header"><h1>Clicked!</h1></div> 
    <div data-role="content"> 
     <p>Clicked content!</p> 
     <a href="#contact" data-rel="back" data-role="button">Go back</a> 
    </div> 
    </div> 

</body> 
</html>  

而這裏的的jsfiddle例如:http://jsfiddle.net/Gajotres/w3ptm/

你有這樣的錯誤:

  1. 在對話框數據角色= 「頁面」絕成爲data-role =「對話框」

    <div data-role="dialog" id="contact" data-theme="c"> 
        <div data-role="header"><h1>Clicked!</h1></div> 
        <div data-role="content"> 
         <p>Clicked content!</p> 
         <a href="#contact" data-rel="back" data-role="button">Go back</a> 
        </div> 
    </div> 
    
  2. 它也必須與主頁面在同一層。

+1

非常感謝你的澄清。 –