[英]jQuery Fancybox on page load, content in iFrame
我想在准備好文檔時加載一個fancybox,但在特定的DIV中,fancybox的內容將來自另一個頁面,顯示為iFrame。 這是我目前擁有的:
$(document).ready(function () {
$.fancybox({
'href' : "#div",
'content' : "content.jsp",
'type' : "iframe",
});
});
HTML:
<div id="div">
</div>
什么都沒有加載。
嘗試這個:
$(document).ready(function () {
$("#div").fancybox({
'href' : 'content.jsp',
'type' : 'iframe'
});
});
HTML
<div id="div">
Click Here
</div>
您不能將div
的內容顯示為iframe而是inline 。
因此,您可以像使用iframe
一樣直接在fancybox中(以編程方式)打開content.jsp
文件:
jQuery(document).ready(function ($) {
$.fancybox({
href: "content.jsp",
type: "iframe"
});
}); // ready
或將content.jsp
文件的內容加載到div#div
容器中,然后在fancybox中顯示內聯內容,例如:
jQuery(document).ready(function ($) {
$("#div").load("content.jsp", function () {
$.fancybox($(this), {
// API options
type: "inline"
});
});
}); // ready
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.