【问题标题】:Jquery mobile - dialog box opens without close buttonJquery mobile - 对话框打开时没有关闭按钮
【发布时间】:2023-04-10 23:41:02
【问题描述】:

我刚刚开始探索 J query mobile。我尝试使用以下代码打开一个对话框。

<a data-role="button" href="test_my_dialog.php" data-icon="plus" data-iconpos="left" data-mini="true" id="test_dialog" data-rel="dialog">Test Dialog </a>

对话框打开但没有关闭按钮和标题,因为它在以下链接Dialogs的演示中显示

这里有什么我遗漏的吗?

编辑: test_my_dialog.php 的标记

    <div data-role="page">
        <div data-role="content">
             <div data-role="fieldcontain">
        <fieldset data-role="controlgroup" data-type="horizontal" data-mini="true">
            <legend>
                Add As
            </legend>
            <input id="radio1" name="RC_type" value="radio1" type="radio">
            <label for="radio1">
                Team Driver
            </label>
            <input id="radio2" name="RC_type" value="radio2" type="radio">
            <label for="radio2">
                Team Member (Driver2)
            </label>
        </fieldset>
    </div>
        </div>
    </div> 

【问题讨论】:

  • 发布 test_my_dialog.php html 标记。
  • 您是否为关闭按钮上传了图片?您可以使用 firebug 之类的工具检查元素是否存在。

标签: jquery-mobile


【解决方案1】:

在对话框中添加一个header div,它会自动在左边获得一个关闭按钮。

Demo

<div data-role="page" id="myDialog">
  <div data-role="header">
    <h1>Header</h1>
  </div>
</div>

如果你想改变按钮的位置到右边,添加data-close-btn="right"属性到对话框div。

<div data-role="page" id="myDialog" data-close-btn="right">

【讨论】:

    【解决方案2】:

    尝试使用以下代码修改对话框的页面定义,并将标题部分添加到对话框页面

    <div id='mydialog' data-role='page' data-add-back-btn='true'>
    ...
    </div>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-04-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多