我已将FancyBox 2添加到我的投资组合中,以便在用户点击图片时以更大的形式显示图像。但问题是FancyBox仅在刷新该页面时起作用,当用户从另一页面定向到该页面时它不起作用。
这是我用于FancyBox的编码:
HTML
<a data-fancybox-type="image" rel="group" class="cta-nav-hover fancybox" href="img/single/burning1.jpg"><img src="img/thumbnails/burning1.jpg" alt="" width="50%" /></a>
SCRIPT
<script type="text/javascript">
$(".fancybox")
.attr('rel', 'gallery')
.fancybox({
padding : 0
});
</script>
EXTRA ADD ONS
<!-- Add fancyBox -->
<link rel="stylesheet" href="fancybox/source/jquery.fancybox.css?v=2.1.5" type="text/css" media="screen" />
<script type="text/javascript" src="fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
<!-- Optionally add helpers - button, thumbnail and/or media -->
<link rel="stylesheet" href="fancybox/source/helpers/jquery.fancybox-buttons.css?v=1.0.5" type="text/css" media="screen" />
<script type="text/javascript" src="fancybox/source/helpers/jquery.fancybox-buttons.js?v=1.0.5"></script>
<script type="text/javascript" src="fancybox/source/helpers/jquery.fancybox-media.js?v=1.0.6"></script>
<link rel="stylesheet" href="fancybox/source/helpers/jquery.fancybox-thumbs.css?v=1.0.7" type="text/css" media="screen" />
<script type="text/javascript" src=/fancybox/source/helpers/jquery.fancybox-thumbs.js?v=1.0.7"></script>