好的就是这个问题。我已经在我的服务器上的测试页面上测试了以下脚本,它工作正常,但是当我将脚本复制到我的实际页面时,它不会运行后加载功能,只是基本的fancybox。我不明白为什么。这是我用过的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文件,那么一切正常。因为它位于我的实际网页中,它会延迟到后续调用,然后忽略其余的。我很难接受各种想法。