Ran*_*ess 10
首先,您必须在无序列表中添加隐藏的div或span标记:
<li>
<a class="thumb" href="/imageurl/image.gif">imageititle</a>
<span id="project-path" style="display:none;">example_path</span>
</li>
Run Code Online (Sandbox Code Playgroud)
然后,将此代码添加到您的galleriffic.js文件中.您正在从span元素中获取路径:
addImage: function(listItem, thumbExists, insert, position) {
var $li = ( typeof listItem === "string" ) ? $(listItem) : listItem;
var $aThumb = $li.find('a.thumb');
** var $path = $li.find('#project-path');
** var projectPath = $path.text();
var slideUrl = $aThumb.attr('href');
var title = $aThumb.attr('title');
var $caption = $li.find('.caption').remove();
var hash = $aThumb.attr('name');
Run Code Online (Sandbox Code Playgroud)
然后,将值添加到图像变量:
var imageData = {
** projectPath:projectPath,
title:title,
slideUrl:slideUrl,
caption:$caption,
hash:hash,
gallery:this,
index:position
};
Run Code Online (Sandbox Code Playgroud)
现在告诉图库更改全尺寸图库图像上的新路径链接:
// Construct new hidden span for the image
var newSlide = this.$imageContainer
.append('<span class="image-wrapper current"><a class="advance-link" rel="history" href="/project/'+imageData.projectPath+'" title="'+imageData.title+'"> </a></span>')
.find('span.current').css('opacity', '0');
Run Code Online (Sandbox Code Playgroud)
并在此处注释库的点击操作,以便您的用户可以使用包装图像的普通链接:
newSlide.find('a')
.append(imageData.image)
//.click(function(e) {
//gallery.clickHandler(e, this);
//})
;
Run Code Online (Sandbox Code Playgroud)