打开magnificPopup窗口:
function showWin(Ids) {
$.magnificPopup.open({
items : [{
src : currentDomain+'/igc/admin_selected_goods.html?Ids='
+ Ids,
type : 'iframe',
height : '150px',
width : '500px'
}]
});
return $.magnificPopup.instance;
}
关闭窗口
function closeWin(popWin){
popWin.close();
}
查看showWin方法可见,弹出窗口是iframe类型,换句话说要在新的页面关闭当前magnificPopup窗口,那么思路如下:
1、在A页面定义一个全局的_instance变量,并调用showWin方法将返回值赋给_instance变量;
var _instance;
_instance = showWin(value);
2、在A页面定义一个closePopWin方法,在其中调用closeWin(_instance)方法;
function closePopWin(){
closeWin(_instance);
}
3、在打开的B页面调用A页面的closePopWin方法。
function closePop(){
window.top.frames[1].frames[1].closePopWin();
}
4、在B页面添加一个button调用closePop方法。
<input type="button" value="取消" οnclick="closePop()"/>