0

我在一个网站上工作,但由于某种原因 JQuery Mobile 拒绝工作。现在,我使用从 JQuery Mobile 示例中复制的代码制作了一个简单的演示页面,如下所示:

  <!DOCTYPE html> 
   <html> 
    <head> 
        <title>My Page</title> 
    <meta name="viewport" content="width=device-width, initial-scale=1"> 
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.1/jquery.mobile-1.2.1.min.css" />
    <script src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
    <script src="http://code.jquery.com/mobile/1.2.1/jquery.mobile-1.2.1.min.js"></script>
</head> 
<body> 

<div data-role="page" id="1">

    <div data-role="header">
        <h1>My Title</h1>
    </div><!-- /header -->

    <div data-role="content">   
        <p>Hello world</p>      
        <a href='#2' data-transition='slide'>2</a>
    </div><!-- /content -->

</div><!-- /page -->


<div data-role="page" id="2">

    <div data-role="header">
        <h1>My Title</h1>
    </div><!-- /header -->

    <div data-role="content">   
        <p>Hello world2</p>     
        <a href='#1' data-transition='slide'>1</a>
    </div><!-- /content -->

</div><!-- /page -->

</body>
</html>

由于某种原因,这不起作用,并返回一个错误说“TypeError:t.split 不是函数”。有人知道出了什么问题吗?

4

1 回答 1

0

尝试更新您正在使用的 jQuery (1.9.2) 和 jQuery Mobile (1.3.1) 框架的版本。

另外,我试过小提琴,你的代码对我有用。

好,知道了。

您只在 id 中添加了数字,我将它们更改为 page1 和 page2:

<div data-role="header">
    <h1>My Title</h1>
</div><!-- /header -->

<div data-role="content">   
    <p>Hello world</p>      
    <a href='#page2' data-transition='slide'>2</a>
</div><!-- /content -->

<div data-role="header">
    <h1>My Title</h1>
</div><!-- /header -->

<div data-role="content">   
    <p>Hello world2</p>     
    <a href='#page1' data-transition='slide'>1</a>
</div><!-- /content -->

现在它起作用了。

于 2013-07-16T08:17:22.907 回答