【问题标题】:Opening jQueryMobile's dialog with a link to specified jQueryMobile page in different file打开 jQueryMobile 的对话框,其中包含指向不同文件中指定 jQueryMobile 页面的链接
【发布时间】:2013-03-28 19:39:31
【问题描述】:

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

当我输入时

<a data-rel="dialog" data-transition="flip" href="c.html">button</a>

在 index.html 中,它应该将 c.html 显示为对话框。但是使用

<a data-rel="dialog" data-transition="flip" href="c.html#0">button</a>

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

【问题讨论】:

  • 你需要使用&lt;a data-rel="dialog" data-transition="flip" href="c.html/#0"&gt;button&lt;/a&gt;
  • id 属性必须以字母开头。
  • @StanCromlish - 它不起作用。
  • @Nelson - 这也是

标签: jquery html css jquery-mobile dialog


【解决方案1】:

这是做不到的。

jQuery Mobile 不支持将查询参数传递给内部/嵌入式页面,但是您可以添加两个插件到您的项目中来支持此功能。有一个轻量级页面params plugin 和一个功能更齐全的jQuery Mobile router plugin 用于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>   

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>   

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-02-07
    • 1970-01-01
    • 1970-01-01
    • 2012-12-24
    • 2013-01-10
    • 1970-01-01
    相关资源
    最近更新 更多