estoy usando el último fancybox (2.0.4) y creé un fancybox para un iframe. el contenido se muestra correctamente agrego un botón "cerrar" a mi html, que está distribuido dentro del iframe. Deseo que el botón de cerrar tenga el mismo resultado que hacer clic en la "x" en la esquina superior derecha de la caja de fantasía. Estoy familiarizado con FancyBox iframe returns parent.$ as undefined (using WordPress), y mi parent
es un objeto DOM sin nada. también intentéFancybox.close() en un iframe
window.parent.jQuery.fancybox.close();
window.parent.jQuery.fn.fancybox.close();
parent.jQuery.fn.fancybox.close();
parent.jQuery.fancybox.close();
¿Alguna ayuda?
ACTUALIZACIÓN:
a.js (vinculado al a.html)
$(document).ready(function() {
$(".fancybox").fancybox({
maxWidth : 800,
maxHeight : 600,
fitToView : false,
width : '70%',
height : '70%',
autoSize : false,
closeClick : false,
type : 'iframe',
openEffect : 'none',
closeEffect : 'none',
afterClose : function() {
window.location.reload();
}
});
});
a.html
<a class="fancybox fancybox.iframe" id="newLink" href="new.html">link</a>
¿Cómo puedo tener un botón dentro de new.html
que cierra la FancyBox iframe ventana
ACTUALIZACIÓN: archivos html completos
a.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
<link rel="stylesheet" href="fancybox/jquery.fancybox.css?v=2.0.4" type="text/css" media="screen" />
<script type="text/javascript" src="fancybox/jquery.fancybox.pack.js?v=2.0.4"></script>
<script type="text/javascript">
$(document).ready(function() {
$(".fancybox").fancybox({
maxWidth : 800,
maxHeight : 600,
fitToView : false,
width : '70%',
height : '70%',
autoSize : false,
closeClick : false,
type : 'iframe',
openEffect : 'none',
closeEffect : 'none',
afterClose : function() {
window.location.reload();
}
});
});
</script>
</head>
<body>
<a class="fancybox fancybox.iframe" id="newLink" href="b.html">link</a>
</body>
</html>
b.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
<link rel="stylesheet" href="fancybox/jquery.fancybox.css?v=2.0.4" type="text/css" media="screen" />
<script type="text/javascript" src="fancybox/jquery.fancybox.pack.js?v=2.0.4"></script>
</head>
<body>
<input type="submit" value="Cancel" id="cancelBtn" onclick="parent.jQuery.fancybox.close()"/>
</body>
</html>
agradezco su respuesta, aunque no está funcionando! '
' y eso es lo que imprime la herramienta de desarrollo de chrome 'UnEdge TypeError: No se puede leer la propiedad 'fancybox' de undefined' – MrRothen primer lugar, muchas gracias. en segundo lugar, si no hay mucho que preguntar, ¿podría comprimirlo y ponerle un enlace? desde que descargué tus archivos, cambié la ruta a mi directorio fancybox y no está funcionando. (el iframe se abre, pero el cierre no funciona) – MrRoth
aquí hay un enlace a mi directorio, que incluye tus archivos y el directorio de fancybox http://www.mediafire.com/?0u04zdrz6v2tdi8 - ¿Cómo es que no es así? ¿trabajando? – MrRoth