使用jquery手机修复网址 [英] fix url using jquery mobile

查看:127
本文介绍了使用jquery手机修复网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用jquery手机构建一个网站,但是当我点击一个按钮,这个按钮指向一个对话框页面,网址出现#& ui-state = dialog 。如果我放入< a data-ajax =false>< / a> ,url是正确的,没有#& ui -state = dialog ,但对话框窗口不能正确显示,因为显然ajax是disable.there有一些方法来解决它?

解决方案

当您打开对话框时,使用 $。mobile.changePage()并设置 changeHash option to false http://jquerymobile.com/demos/1.0.1/docs/api/methods.html

  //委托事件绑定,因此DOM中的元素现在和将来将被绑定到
$(document).delegate('#my-dialog-button','click',function() {

//更改对话框,强制哈希保持不变,页面被视为对话框
$ .mobile.changePage($('#my-dialog' ),{
changeHash:false,
role:'dialog'
});
});


I'm using jquery mobile to building a site but when I click on a button and this button points to a dialog page, in the URL appears #&ui-state=dialog. If I put in the <a data-ajax="false"></a> the url is correct without #&ui-state=dialog but the dialog window doesn't show correctly because obviously ajax is disable.there is some way to fix it?

解决方案

When you open the dialog, use $.mobile.changePage() and set the changeHash option to false: http://jquerymobile.com/demos/1.0.1/docs/api/methods.html

//delegate the event binding so elements in the DOM now and in the future will be bound-to
$(document).delegate('#my-dialog-button', 'click', function () {

    //change to the dialog, forcing the hash to remain the same and the page to be viewed as a dialog
    $.mobile.changePage($('#my-dialog'), {
        changeHash : false,
        role       : 'dialog'
    });
});

这篇关于使用jquery手机修复网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆