使用http://fancyapps.com/fancybox/#support使用的fancybox 2版 - 当关闭只需关闭
我想从我的主网页打开的fancybox提供的fancybox 2版第2次的fancybox重启第一的fancybox代替,但第一次看中的盒子内的第二的fancybox可以调用。但是,当第二个花式框关闭。而不是简单地关闭(在角落按X或按Esc),我希望它重新打开第一个fancybox。我该怎么做呢?
谢谢你 - 我已经寻找一个答案互联网,但发现有关我的查询申请的fancybox的早期版本与新版本(2.0)的答案...
我的代码如下:
主要页面 -
<!DOCTYPE html>
<head>
<!-- Add jQuery library -->
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
<!-- Add fancyBox main JS and CSS files -->
<script type="text/javascript" src="./source/jquery.fancybox.js"></script>
<link rel="stylesheet" type="text/css" href="./source/jquery.fancybox.css" media="screen" />
<script type="text/javascript">
$(document).ready(function() {
/*
Simple image gallery. Uses default settings
*/
$('.fancybox').fancybox();
/*
Different effects
*/
// Change title type, overlay opening speed and opacity
$(".fancybox-effects-a").fancybox({
helpers: {
title : {
type : 'outside'
},
overlay : {
speedIn : 500,
opacity : 0.95
}
}
});
/*
Thumbnail helper. Disable animations, hide close button, arrows and slide to next gallery item if clicked
*/
$('.fancybox-thumbs').fancybox({
prevEffect : 'none',
nextEffect : 'none',
closeBtn : false,
arrows : false,
nextClick : true,
helpers : {
thumbs : {
width : 50,
height : 50
}
}
});
});
</script>
<a href="1stFancyBox.html" class="fancybox fancybox.ajax">1st Fancy Box</a>
</html>
1stFancyBox.html -
<html>
<a href="2ndFancyBox.html" class="fancybox fancybox.ajax">2nd FancyBox</a>
</html>
2ndFancyBox.html -
<html>
<body>
Hellloooooooooo</body>
</html>
谢谢:)
似乎不工作,当我关闭第二看中箱页面只是变暗......请帮助 我已经做了,你这里说的一切,代替班。更改$(“。fancybox”)。fancybox();到$(“。fancybox1”)。fancybox(); 并补充 $( “fancybox2。 ”)的fancybox:;({ afterClose函数(){$ ()触发( “点击”);} “ fancybox1。”}) 主页上fancybox1内... $(” fancybox1。 “)的fancybox({ $()的fancybox({ afterClose。” fancybox2 “:函数(){$ (” fancybox1" 。) 。触发( “点击”); } }); }); – JohnHelp
看来你混了一下,看我的更新,我添加了一个DEMO。随意分析和比较源代码。 fancybox脚本应该只在主页面上。链接和内容在第一个和第二个html文件中有所不同。 – JFK