我想知道是否有人可以帮助我。
我已经编写了一个脚本来创建这个图片库页面。我正在使用“fancyBox”来创建幻灯片和一个源自这里的 jquery 演示,我已经对其进行了调整以提供删除功能。
我遇到的问题在于我的代码的这些行:
<ul id="gallery" class="gallery ui-helper-reset ui-helper-clearfix">
<?php for ($i = 0; $i < $descriptions->documentElement->childNodes->length; $i++) :
$xmlFile = $descriptions->documentElement->childNodes->item($i);
$name = htmlentities($xmlFile->getAttribute('originalname'), ENT_COMPAT, 'UTF-8');
$description = htmlentities($xmlFile->getAttribute('description'), ENT_COMPAT, 'UTF-8');
$source = $galleryPath . rawurlencode($xmlFile->getAttribute('source'));
$thumbnail = $thumbnailsPath . rawurlencode($xmlFile->getAttribute('thumbnail'));
?>
<li class="ui-widget-content ui-corner-tr">
<a class="fancybox" rel="allimages" title="<?php echo $name; ?>" href="<?php echo $source; ?>"><img src="<?php echo $thumbnail; ?>"alt="<?php echo $description; ?>" width="96" height="72"/> </a><a href="link/to/trash/script/when/we/have/js/off" title="Delete this image" class="ui-icon ui-icon-trash">Delete image</a>
<?php endfor; ?>
</li>
</ul>
包含这些行:<ul id="gallery" class="gallery ui-helper-reset ui-helper-clearfix">
及其<li class="ui-widget-content ui-corner-tr">
各自的结束标记后,“fancyBox”功能将不起作用。没有它们,它工作正常。
我对 jQuery 比较陌生,我已经为此工作了几天,但似乎找不到解决方案。
我只是想知道是否有人可以看看这个,让我知道我哪里出错了。
对于其他信息,我在下面添加了“fancyBox”脚本。
<script type="text/javascript">
$('.fancybox').fancybox({
openEffect : 'elastic',
closeEffect : 'elastic',
padding : 20,
fitToView : true,
prevEffect : 'none',
nextEffect : 'none',
closeBtn : false,
arrows : false,
helpers : {
title : {
type : 'inside'
},
buttons : {}
},
afterLoad : function() {
this.title = 'Image ' + (this.index + 1) + ' of ' + this.group.length + (this.title ? ' - ' + this.title : '');
}
});
</script>
非常感谢和亲切的问候