Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

javascript - open fancybox over another fancybox ajax

I have a Fancybox which shows me some dialog and a button to click. When i click this button i want to open another fancybox over the existing one.. or on another position on the screen, but i dont want to lose the already existing fancybox. I want to fill both of them by an ajax request.. Is this possible? Because what i tried resulted in losing the original fancybox..

I got this code:

$.fancybox.showActivity();
                $.ajax({
                    type        : "POST",
                    cache       : false,
                    url     : "../testservlet?select=1,
                    data        : $(this).serializeArray(),
                    height      : 600,
                    width       : 800,
                    padding     : 30,
                    showCloseButton : true,
                    success     : function(data) {
                        $.fancybox(data);
                    }
                });

$.fancybox.showActivity();
                $.ajax({
                    type        : "POST",
                    cache       : false,
                    url     : "test?select=2,
                    data        : $(this).serializeArray(),
                    padding     : 30,
                    showCloseButton : true,
                    success     : function(data) {
                        $.fancybox(data);
                    }
                }); 
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Unfortunately you cannot have more than a single fancybox at the same time ... it has been designed like that.

You could have another fancybox inside of the existing one though (when open an external page -via iframe- with fancybox in it) ...or you could open that inner fancybox on the parent page, creating the illusion that you have two fancyboxes on the same page. Check here for more

On the other hand, the only lightbox I remember that supports multiple boxes is jQuery Tools Overlay


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...