打开jQueryMobile的对话框,其中包含指向不同文件中指定的jQueryMobile页面的链接

bur*_*tek 0 jquery html5 dialog css3 jquery-mobile

我有两个文件 - index.html和c.html.

当我输入

<a data-rel="dialog" data-transition="flip" href="c.html">button</a>
Run Code Online (Sandbox Code Playgroud)

在index.html中,它的工作原理应该是将c.html显示为对话框.然而使用

<a data-rel="dialog" data-transition="flip" href="c.html#0">button</a>
Run Code Online (Sandbox Code Playgroud)

根本不起作用(我希望它在c.html中显示id ="0"页面).如何使它工作?

Gaj*_*res 6

这是不可能做到的.

jQuery Mobile不支持将查询参数传递给内部/嵌入页面,但有两个插件可以添加到项目中以支持此功能.有一个轻量级页面params插件和一个功能更全面的jQuery Mobile路由器插件,可与backbone.js或spine.js一起使用.一个名为routerlite的新插件只用四种方法就可以实现简单:routeinit,routechange,pageinit和pagechange.

官方文档:http://jquerymobile.com/demos/1.2.0/docs/pages/page-navmodel.html

证明:

的index.html

<!DOCTYPE html>
<html>
<head>
    <title>jQM Complex Demo</title>
    <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; minimum-scale=1.0; user-scalable=no; target-densityDpi=device-dpi"/>
    <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" id="index">
        <div data-theme="a" data-role="header">
            <h3>
                First Page
            </h3>
            <a href="index3.html#second" class="ui-btn-right">Next</a>
        </div>

        <div data-role="content">

        </div>

        <div data-theme="a" data-role="footer" data-position="fixed">

        </div>
    </div>  
</body>
</html>   
Run Code Online (Sandbox Code Playgroud)

index3.html

<!DOCTYPE html>
<html>
<head>
    <title>jQM Complex Demo</title>
    <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; minimum-scale=1.0; user-scalable=no; target-densityDpi=device-dpi"/>
    <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" id="third">
        <div data-theme="a" data-role="header">
            <h3>
                Third Page
            </h3>
            <a href="#second" class="ui-btn-right">Next</a>
        </div>

        <div data-role="content">

        </div>

        <div data-theme="a" data-role="footer" data-position="fixed">

        </div>
    </div> 
    <div data-role="page" id="second">
        <div data-theme="a" data-role="header">
            <h3>
                Second Page
            </h3>
            <a href="#index" class="ui-btn-left">Back</a>
        </div>

        <div data-role="content">

        </div>

        <div data-theme="a" data-role="footer" data-position="fixed">

        </div>
    </div>    
</body>
</html>   
Run Code Online (Sandbox Code Playgroud)