问题
Can someone explain the difference between loading content into Fancybox via iframe vs Ajax?
Also, is it possible to have a gallery (e.g. rel="gallery") with either iframed or Ajax'ed content?
thanks.
回答1:
When you use iframe
mode, the opened page works as a totally separated and independent page from the calling page and it may have its own structure, functionality and styles. You could skip to open the page in fancybox and open it in a new window/tab.
On the other hand, using ajax
mode, the opened content becomes part of the calling page DOM structure (normally as a html element like a <div>
) and can inherit the styles, functionality and properties of the calling page.
Regarding :
is it possible to have a gallery (e.g. rel="gallery") with either
iframed or Ajax'ed content?
... the answer is yes. You could combine in the same fancybox gallery, images, swf objects, inline content (from a hidden <div>
), youtube videos, ajax content, iframed pages, pdf documents and hard-coded custom content inside the script.
Here is an example of a gallery that combines images and youtube videos.
来源:https://stackoverflow.com/questions/15821076/fancybox-jquery-iframe-vs-ajax