在jQuery Mobile中以编程方式创建2个弹出窗口(从第一个弹出窗口调用第二个弹出窗口) [英] creating 2 popup's programatically(calling 2nd popup from 1st one) in jquery mobile

查看:212
本文介绍了在jQuery Mobile中以编程方式创建2个弹出窗口(从第一个弹出窗口调用第二个弹出窗口)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要以编程方式创建2个弹出窗口,每个弹出窗口应包含一个INPUT框,一个OK按钮和一个CANCEL按钮.

I need to create 2 popup's programmatically and each popup should contain one INPUT box and one OK button and one CANCEL button.

单击第一个弹出的OK按钮后,我必须调出第二个弹出窗口.

Upon clicking on the first popup OK button i have to bringup the second popup.

我是jquery mobile的新手,我研究了许多文档,但没有获得正确的方法.

I am new to jquery mobile, i looked into many docs but i didnt get proper way to do it.

我试图做这样的事情.但没有用.

i tried to do it something like this. but didn't worked.

var $popUp = $("<div/>").popup({
        dismissible : false,
        theme : "a",
        overlyaTheme : "a",
        transition : "pop"
    }).bind("popupafterclose", function() {
                    //remove the popup when closing
        $(this).remove();
    });

如何在我的js文件中执行此操作?..

How can I do it in my js file?..

谢谢:).

推荐答案

2 Popus不能同时处于活动状态.

2 Popus can not be active at the same time.

有一个解决方法,这是我的旧示例: http://jsfiddle.net/Gajotres/8Arrt/

There's a workaround, and here's my old example: http://jsfiddle.net/Gajotres/8Arrt/

$(document).on('pagebeforeshow','#index',function(e,data){    
    $('#test-button').on('click', function(e) {
        $('#MyFirstPopup').popup('open', {x : 100, y : 500, positionTo : 'origin'});
    });    

     $('#popup-button').on('click', function(e) {
         setTimeout(function(){$('#MySecondPopup').popup('open', {x : 100, y : 100, positionTo : 'origin'});},100)
         $('#MyFirstPopup').popup('close');
    });
});

基本上,如果要打开第二个弹出窗口,则必须关闭第一个弹出窗口.这就是为什么我们需要setTimeout在第一个弹出窗口关闭后再弹出第二个弹出窗口.

Basically if you want to open second popup you must close the first one. That's why we need setTimeout to opet second popup after the first one has been closed.

这篇关于在jQuery Mobile中以编程方式创建2个弹出窗口(从第一个弹出窗口调用第二个弹出窗口)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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