Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
SimpleModel-使用关闭按钮关闭iframe_Iframe_Simplemodal - Fatal编程技术网

SimpleModel-使用关闭按钮关闭iframe

SimpleModel-使用关闭按钮关闭iframe,iframe,simplemodal,Iframe,Simplemodal,所以我四处搜索,找不到确切的答案。我希望我的iframe有一个关闭按钮,这样用户就可以单击它而不是使用ESC键来关闭SimpleModel容器 我尝试了几种方法,但似乎没有任何东西被传递到iframe中以关闭容器。尝试以下方法: parent.$.modal.close(); 试试这个: $(document).keyup(function (e) { if (e.keyCode == 27) { return; } });

所以我四处搜索,找不到确切的答案。我希望我的iframe有一个关闭按钮,这样用户就可以单击它而不是使用ESC键来关闭SimpleModel容器

我尝试了几种方法,但似乎没有任何东西被传递到iframe中以关闭容器。

尝试以下方法:

parent.$.modal.close();
试试这个:

$(document).keyup(function (e) {
        if (e.keyCode == 27) {
            return;
        }   
    });

我也有同样的问题。当我的iFrame的“src”属性使用https作为协议时发生。在这种情况下,
parent.$.modal.close()不起作用

我所做的是添加Eric在SimpleModel项目页面上提到的常用关闭按钮

将closeHTML行添加到模式脚本:

closeHTML:"<a href='#' class='modalCloseImg' alt='Close' title='Close'><a>",
closeHTML:

下面是一个完整的脚本:

<script type="text/javascript">
// Display an external page using an iframe
var src = "http://your.domain.name/your_source_file.html";
$.modal('<iframe src="' + src + '" height="450" width="830" style="border:0">', {
    closeHTML:"<a href='#' class='modalCloseImg' alt='Close' title='Close'><a>", /* Add this <a> tag for the Close image to appear. */
    containerCss:{
        backgroundColor:"#fff",
        borderColor:"#fff",
        height:450,
        padding:0,
        width:830
    },
    overlayClose:false /* Stops user from clicking overlay to exit modal. */
});
</script>

//使用iframe显示外部页面
var src=”http://your.domain.name/your_source_file.html";
$.modal(“”{
closeHTML:,/*添加此标记以显示关闭图像*/
集装箱船:{
背景颜色:“fff”,
边框颜色:“fff”,
身高:450,
填充:0,
宽度:830
},
OverlyClose:false/*停止用户单击覆盖以退出模式*/
});
我希望这有帮助! 干杯
Paul

我用一种简单的方法解决了这个问题,但我使用了一个链接


祝你好运!

事实上,我现在的代码中包含了这一点,但我没有工作。这里有一个关于我所拥有的功能的快速忽略。函数close(){parent.$.modal.close();}每次都非常有效。在iframe中:$('.simplemodal close')。单击(函数(){parent.$.modal.close();});
<script type="text/javascript">
// Display an external page using an iframe
var src = "http://your.domain.name/your_source_file.html";
$.modal('<iframe src="' + src + '" height="450" width="830" style="border:0">', {
    closeHTML:"<a href='#' class='modalCloseImg' alt='Close' title='Close'><a>", /* Add this <a> tag for the Close image to appear. */
    containerCss:{
        backgroundColor:"#fff",
        borderColor:"#fff",
        height:450,
        padding:0,
        width:830
    },
    overlayClose:false /* Stops user from clicking overlay to exit modal. */
});
</script>