creating 2 popup's programatically(calling 2nd popup from 1st one) in jquery mobile

帅比萌擦擦* 提交于 2019-12-14 04:03:16

问题


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

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

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();
    });

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

Thanks:).


回答1:


2 Popus can not be active at the same time.

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');
    });
});

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.



来源:https://stackoverflow.com/questions/16563567/creating-2-popups-programaticallycalling-2nd-popup-from-1st-one-in-jquery-mob

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!