[英]How do I chain multiple jquery fancyboxes?
我在我的Web應用程序中將fancybox用於模態。
在某些情況下,我想在第二個花式盒子已經打開的情況下彈出它。 有人知道這樣做的方法嗎? 我可以在另一個關閉后打開一個,或者兩個都同時在另一個下面打開。
同樣,我在應用程序中使用了jquery和fancybox。
這是一個討論相同問題的相關主題。. 如何在另一個關閉后打開一個Fancybox?
編輯:在討論中, https ://stackoverflow.com/users/139396/okw提供了一個很好的示例
我已將示例放在jsfiddle上: http : //jsfiddle.net/CkK8N/
我自己已經解決了這個問題。
場景:
關鍵點
程式碼片段:
if (parent) {
// if in an iframe we need to show activity for the parents' fancybox
parent.$.fancybox.showActivity();
}
else {
// otherwise show activity for the fancybox of the current window
$.fancybox.showActivity();
}
// I'm using Ajax to fetch the content but you can fetch it in other ways too
$.ajax({
url: "your url goes here",
type: "POST",
contenttype: "text/xml; charset=utf-8",
dataType: "xml",
data: { "name": "john"},
success: function (data, textStatus, jqXHR) {
if (parent) {
// if in an iframe we need to push the content into the parents' fancybox
parent.$.fancybox($(jqXHR.responseXML).text());
parent.$.fancybox.resize();
}
else {
// otherwise push the content into the fancybox of the current window
$.fancybox($(jqXHR.responseXML).text());
$.fancybox.resize();
}
}
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.