Pablo
Pablo

Reputation: 2386

JQM 1.3 changePage 'role dialog' fails in Chrome

I need to change to a different page on start up and I want it to be a dialog. This works in 1.2 and works with IE and FireFox in 1.3. Chrome displays the dialog then immediately reverts to the first page. If I remove the "role: dialog" it works with everyone. I've tried a hidden hyperlink that I force a click on ... same result. Chrome (latest version) reverts to page1.

Any ideas on how to fix this?

Here is a simplified fiddle http://jsfiddle.net/stocksp/P4ZWj/3/

    div data-role="page" id="page1">
       <div data-role="content">
           <h6>page one content</h6>
       </div>
    </div>
    <div data-role="page" id="page2">
        <div data-role="header">
            <h1 class="title">My DIALOG </h1>
        </div><!-- /header -->
        <div data-role="content">
            Dialog Content
        </div>
    </div>

$(document).delegate("#page1", "pageinit", function () {
            $.mobile.changePage('#page2', { transition: 'pop', role: 'dialog' });
        });

Upvotes: 0

Views: 565

Answers (1)

Edyn
Edyn

Reputation: 2497

Quick workaround til this is fixed: wrap the changePage method in a setTimeout...

$(document).delegate("#page1", "pageinit", function () {
    setTimeout(function () {
        $.mobile.changePage('#page2', { transition: 'pop', role: 'dialog' });
    }, 100);
});

Upvotes: 2

Related Questions