メインページ内に iframe があります。iframe ページ内に modalpopup があります。したがって、modalpopup が表示される場合、modalpopup の親は iframe 本体とメイン ページの親本体です。したがって、オーバーレイはページ全体ではなく、iframe のみをカバーします。
jQueryを使用して、modalpopupをiframeから親windows body要素(または親body内の他の要素)に移動しようとしました。無効な引数エラーが発生します。
iframe 内のページから modalpopup を表示するにはどうすればよいですか? ドキュメント全体、親ドキュメントもカバーする必要がありますか?
アップデート:
同じ動作を実現することに関心のあるユーザーはほとんどいないため、回避策は次のとおりです。
私が提案する最善の回避策は、メインページに modalpopup を配置し、iframe から呼び出して、次のように言うことです。
/* function in the main(parent) page */
var _onMyModalPopupHide = null;
function pageLoad(){
// would be called by ScriptManager when page loads
// add the callback that will be called when the modalpopup is closed
$find('MyModalPopupBehaviorID').add_hidden(onMyModalPopupHide);
}
// will be invoked from the iframe to show the popup
function ShowMyModalPopup(callback) {
_onMyModalPopupHide = callback;
$find('MyModalPopupBehaviorID').show();
}
/* this function would be called when the modal popup is closed */
function onMyModalPopupHide(){
if (typeof(_onMyModalPopupHide) === "function") {
// fire the callback function
_onMyModalPopupHide.call(this);
}
}
/* functions in the page loaded in the iframe */
function ShowPopup(){
if(typeof(window.parent.ShowMyModalPopup) === "function") {
window.parent.ShowMyModalPopup.apply(this, [OnPopupClosed]);
}
}
// will be invoked from the parent page .. after the popup is closed
function OnPopupClosed(){
// do something after the modal popup is closed
}
それが役に立てば幸い