2013-10-08 59 views
1

我正在关注的入门代码,jQuery Mobile的入门错误

这是代码,

<!DOCTYPE html> 

<html> 
<head> 
    <title>jQuery Mobile</title> 
    <meta charset="UTF-8"/> 
    <meta name="viewport" content="width=device-width, 
    initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no"/> 
    <link href="lib/jquery/jquery.mobile-1.3.2.css" rel="stylesheet" type="text/css" /> 
    <script src="lib/jquery/jquery.mobile-1.3.2.js"></script> 
    <script src="lib/jquery/jquery-1.9.1.js"></script> 

</head> 
<body> 
    <div data-role="page"> 
     <div data-role="header"> 
      <h1>HOME</h1> 
     </div> 
    </div> 
    <div data-role="content"> 
     <a href="02_menuform.html" data-role="button">MENU</a> 
     <a href="02_busform.html" data-role="button">BUS</a> 
     <a href="02_restaurantform.html" data-role="button">RESTAURANT</a> 
    </div> 
</body> 
</html> 

,但我有一个这样的错误,

Uncaught TypeError: Cannot set property 'mobile' of undefined jquery.mobile-1.3.2.js:26 
(anonymous function) jquery.mobile-1.3.2.js:26 
(anonymous function) jquery.mobile-1.3.2.js:27 
(anonymous function) jquery.mobile-1.3.2.js:22 
(anonymous function) jquery.mobile-1.3.2.js:24 

,它不适用jquery手机样式表(按钮和css类的东西)

有什么问题?

+0

把你的jQuery lib放在移动js上面.. –

+0

呵呵?有用!它与序列有关吗?! – Canna

回答

7

您需要将jquery放置在移动js之前。

更换

<script src="lib/jquery/jquery.mobile-1.3.2.js"></script> 
<script src="lib/jquery/jquery-1.9.1.js"></script> 

<script src="lib/jquery/jquery-1.9.1.js"></script> 
<script src="lib/jquery/jquery.mobile-1.3.2.js"></script> 

而且,最好你<div data-role="content">应该是<div data-role="page">的一部分。

+0

感谢快速响应:) – Canna