Mat*_*iby 0 javascript jquery lightbox fancybox
当siteB上的用户点击提交时,我在siteB上有一个iframe,其中有一个来自siteA的
<input type="submit" value="Save url" name="commit" method="post" id="url_submit">
Run Code Online (Sandbox Code Playgroud)
我需要灯箱关闭
我尝试添加
$('#url_submit').click(function(){
$.fn.fancybox.close();
});
Run Code Online (Sandbox Code Playgroud)
两个网站都没有,我有点困惑
首先,siteA和siteB属于同一个域吗?如果是这样,你可以试试
window.parent.jQuery.fn.fancybox.close();
Run Code Online (Sandbox Code Playgroud)
但如果他们不是,你将不得不创建一个关闭你的fancybox的回调网址,并在你的表单提交时重定向到这个网址.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script>
</head>
<body>
<script type="text/javascript">
$(function () {
window.parent.jQuery.fn.fancybox.close();
});
</script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9153 次 |
| 最近记录: |