pageinit上的jQuery移动弹出窗口

use*_*891 4 page-init jquery-mobile

我希望一旦页面加载就打开弹出窗口,但似乎卡在旋转轮上.

这是一个小提琴手,以证明任何帮助将被欣赏的问题.

http://jsfiddle.net/Ohpyx/UGfXG/

我正在使用的代码是:

$(document).live('pageinit',function(event){
    $('#popupBasic').popup('open');
})?
Run Code Online (Sandbox Code Playgroud)

Jas*_*per 6

这对我有用:

$(document).on('pageinit', '.ui-page',function(event){
    setTimeout(function () {
        $('#popupBasic').popup('open');
    }, 0);//Note the comment below from @Taifun.
})?
Run Code Online (Sandbox Code Playgroud)

您有一个竞争条件,这会将弹出代码放在队列的末尾.

这是一个演示:http://jsfiddle.net/UGfXG/6/

注意:我替换.live().on()(委托的风格),因为前者已经从jQuery 1.7折旧了.