admin管理员组文章数量:1410712
I'm using fancybox for modals in my web application.
There are cases when I'd like to popup a 2nd fancybox while one is already opened. Does anyone know of a way to do this? I'm ok with one opening after the other closes, or both being open at the same time one underneath the other.
Again, i'm using jquery and fancybox in my application.
I'm using fancybox for modals in my web application.
There are cases when I'd like to popup a 2nd fancybox while one is already opened. Does anyone know of a way to do this? I'm ok with one opening after the other closes, or both being open at the same time one underneath the other.
Again, i'm using jquery and fancybox in my application.
Share Improve this question asked Mar 24, 2011 at 15:45 silksilk 5021 gold badge6 silver badges14 bronze badges 2- If your not tied down to Fancybox in particular highslide. this one does that job by default. Try opening several on the homepage – Dan Hanly Commented Mar 24, 2011 at 15:52
- Highslide does look to be nice, but I'm trying to keep this free. It does however do what i'm needing. – silk Commented Mar 24, 2011 at 16:15
2 Answers
Reset to default 5Here is a good relevant thread discussing the same thing.. How do I open one Fancybox after another closes?
EDITED: In the discussion, there is a good example provided by https://stackoverflow./users/139396/o-k-w
I have placed the example on jsfiddle: http://jsfiddle/CkK8N/
I've just tackled this problem myself.
Scenario:
- Launching one fancybox using an iframe
- From the opened fancybox, open another fancybox with content delivered by an ajax webservice.
Key points
- If using fancybox and iframes, you need to use parent.$.fancybox, otherwise $.fancybox will do.
- Don't forget to show activity before loading content
- Don't forget to resize after loading the content
Code snippet:
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();
}
}
});
本文标签: javascriptHow do I chain multiple jquery fancyboxesStack Overflow
版权声明:本文标题:javascript - How do I chain multiple jquery fancyboxes? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745028191a2638332.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论