FancyBox 显示来自 href 的内容
FancyBox shows content from href
Html
<table>
<tr>
<td>1</td>
<td>CountryName</td>
<td>
<div class="action">
<a class="edit-country" href="/Edit-Country?countryId=1"></a>
<a class="delete-country" href="/Delete-Country?countryId=1"></a>
</div>
</td>
</tr>
</table>
脚本
$(".edit-country").fancybox({
type: "inline",
modal: true,
closeBtn: false,
helpers: {
title: null
}
});
我希望如果我单击 Edit
,它将打开一个弹出窗口,其中包含 href
获得的内容。但这将我带到另一页。
如果我使用 type='ajax'
它会在同一页面打开,但它没有初始化 Edit-Country
页面的 document.ready
方法。
有什么方法可以在同一个页面打开并同时初始化Edit-Country
页面的document.ready
方法吗?
当您使用不同的页面时,您需要将类型设置为'iframe'。
当您想从内部页面 div/panel
弹出窗口 window 中显示时使用内联
$(".edit-country").fancybox({
type: "iframe",
modal: true,
closeBtn: false,
helpers: {
title: null
}
});
Html
<table>
<tr>
<td>1</td>
<td>CountryName</td>
<td>
<div class="action">
<a class="edit-country" href="/Edit-Country?countryId=1"></a>
<a class="delete-country" href="/Delete-Country?countryId=1"></a>
</div>
</td>
</tr>
</table>
脚本
$(".edit-country").fancybox({
type: "inline",
modal: true,
closeBtn: false,
helpers: {
title: null
}
});
我希望如果我单击 Edit
,它将打开一个弹出窗口,其中包含 href
获得的内容。但这将我带到另一页。
如果我使用 type='ajax'
它会在同一页面打开,但它没有初始化 Edit-Country
页面的 document.ready
方法。
有什么方法可以在同一个页面打开并同时初始化Edit-Country
页面的document.ready
方法吗?
当您使用不同的页面时,您需要将类型设置为'iframe'。 当您想从内部页面 div/panel
弹出窗口 window 中显示时使用内联$(".edit-country").fancybox({
type: "iframe",
modal: true,
closeBtn: false,
helpers: {
title: null
}
});