好的,这就是问题所在。我已经在我的服务器上的测试页面上测试了以下脚本,它工作正常,但是当我将脚本复制到我的实际页面时,它不会运行后加载功能,只是基本的幻想框。我不明白为什么。这是我用过的html
在头部分......
<!-- Add jQuery library -->
<script type="text/javascript" src="../lib/jquery-1.10.1.min.js"></script>
<!-- Add mousewheel plugin (this is optional) -->
<script type="text/javascript" src="../lib/jquery.mousewheel-3.0.6.pack.js"></script>
<!-- Add fancyBox main JS and CSS files -->
<script type="text/javascript" src="../source/jquery.fancybox.js?v=2.1.5"></script>
<link rel="stylesheet" type="text/css" href="../source/jquery.fancybox.css?v=2.1.5
media="screen" />
<!-- Add Button helper (this is optional) -->
<link rel="stylesheet" type="text/css" href="../source/helpers/jquery.fancybox
buttons.css?v=1.0.5" />
<script type="text/javascript" src="../source/helpers/jquery.fancybox-buttons.js
v=1.0.5"></script>
<!-- Add Thumbnail helper (this is optional) -->
<link rel="stylesheet" type="text/css" href="../source/helpers/jquery.fancybox
thumbs.css?v=1.0.7" />
<script type="text/javascript" src="../source/helpers/jquery.fancybox-thumbs.js
v=1.0.7"></script>
<!-- Add Media helper (this is optional) -->
<script type="text/javascript" src="../source/helpers/jquery.fancybox-media.js
v=1.0.6"></script>
<script type="text/javascript">
$(document).ready(function() {
$('.fancybox-buttons').fancybox({
openEffect : 'none',
closeEffect : 'none',
prevEffect : 'none',
nextEffect : 'none',
closeBtn : false,
helpers : {
title : {
type : 'inside'
},
buttons : {}
},
afterLoad: function() {
this.title = 'Image ' + (this.index + 1) + ' of ' + this.group.length + (this.title ? '
- ' + this.title : '');
}
});
</script>
<style type="text/css">
.fancybox-custom .fancybox-skin {
box-shadow: 0 0 50px #222;
}
</style>
然后作为标签内调用的示例
<a class="fancybox-buttons" href="img/parts/billet-1.jpg" data-fancybox-
group="button" title="Lightech Mirror Block Off Plates"><img
src="img/parts/billet/thumbnail.jpg" alt=""/></a>
<a class="fancybox-buttons" href="img/parts/billet/billet-2.jpg" data-fancybox
-group="button" title="Oberon Bar End Mirrors"></a>
如果我把这段代码放到一个空白的 html 页面中,比如我提到的 test.html 文件,一切都很好。正如它在我的实际网页中一样,它运行到 afterload 调用然后忽略其余部分。我为想法难住了。