使用jquery mobile修复网址

eng*_*zzy 7 url jquery dialog jquery-mobile

我正在使用jquery mobile来构建一个站点但是当我点击一个按钮并且这个按钮指向一个对话框页面时,会出现一个URL #&ui-state=dialog.如果我输入<a data-ajax="false"></a>的网址是正确的,#&ui-state=dialog但对话框窗口没有正确显示,因为很明显ajax是禁用的.有什么方法可以修复它吗?

Eag*_*one 17

尝试在popup div标签中使用data-history ="false",如:

<div data-history="false" data-role="popup" id="options-list-div" data-theme="b" data-overlay-theme="b">
Run Code Online (Sandbox Code Playgroud)

祝好运!:-)


Jas*_*per 1

打开对话框时,使用选项$.mobile.changePage()并将其设置changeHashfalsehttp://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'
    });
});
Run Code Online (Sandbox Code Playgroud)