关闭JQuery-mobile Dialog会导致崩溃

时间:2014-04-17 21:03:25

标签: jquery-mobile-dialog

我正在使用JQuery-mobile在移动应用上工作,而且我的对话框出现问题,每当我尝试关闭对话框时(使用默认的关闭按钮),应用就会冻结。

密码:

<link rel="stylesheet" href="http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.css" /> <!-- JQuery Mobile CSS link -->

<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script> <!-- JQuery Mobile link stored on CDN-->
<script src="http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.js"></script> <!-- JQuery Mobile link stored on CDN -->

相对主页代码:

<p><a href="#register" data-role="button" data-rel="dialog" data-transition="pop">Register</a></p>

对话代码:

    <!-- Start of third page: #register -->
<div data-role="page" id="register">

    <div data-role="header" data-theme="e">

        <h1>Activation</h1>
    </div><!-- /header -->

    <div data-role="content" data-theme="d">    

        <h2>Licence Key</h2>
        <p>Please enter your licence key in order to activate your additional features of 20Keys</p>        

            <div data-demo-html="true">
                <div class="ui-field-contain">
                    <label for="licenseKey">Licence Key:</label>
                    <input type="text" name="licenseKey" id="key" placeholder="Insert Key" value="">
                </div>
            </div><!--/demo-html -->

    </div><!-- /content -->

    <div data-role="footer">

        <p><a href="#one" data-role="button" data-inline="true" data-icon="lock">Activate Now</a>   
        <a href="#one" data-role="button" data-inline="true" data-icon="cancel">Cancel</a></p>  
    </div><!-- /footer -->
</div><!-- /page register -->

此时激活按钮(正在进行中)只是返回主页。如果您发现可能导致此问题的任何内容,我将非常感谢您的评论。

代码为:

时,“页脚”按钮出现同样的问题
<p><a href="#one" data-rel="back" data-role="button" data-inline="true" data-icon="lock">Activate Now....</a>   
    <a href="#one" data-rel="back" data-role="button" data-inline="true" data-icon="cancel">Cancel</a></p>

我必须删除data-rel="back"才能解决此问题。

如果有帮助,请使用Chrome。提前谢谢。

1 个答案:

答案 0 :(得分:0)

我发现问题是什么......

你不能在对话框页面中使用data-rel =“back”,因为技术上没有用于对话框页面的后页,因为它会像新标签一样弹出。

解决我的问题的正确方法是使用href =“#one”或者可能使用data-rel =“close”而不是data-rel =“back”。

相关问题