我正在使用我编辑过的免费响应式网页模板来为朋友制作一个小型投资组合网站。我遇到的问题是,当我在Fancybox窗口中选择特定的图库和视图时,它将继续点击所有图像,而不是单击该特定图库中的图像。在fancybox中存在同位素过滤问题
我一直在寻找并找到这个解决方案(https://groups.google.com/forum/#!topic/fancybox/ncVsViD2v9o),但我没有真正掌握JavaScript知识,所以我不确定这是否适用于我或者如何将其应用到模板的代码中。我已经包含和HTML的一部分我相信这是下面的相关JS:
HTML
<!-- Portfolio Projects -->
<div class="row">
<div class="span3">
<!-- Filter -->
<nav id="options" class="work-nav">
<ul id="filters" class="option-set" data-option-key="filter">
<li class="type-work">Photography</li>
<li><a href="#filter" data-option-value="*" class="selected">All Images</a>
</li>
<li><a href="#filter" data-option-value=".people">People</a>
</li>
<li><a href="#filter" data-option-value=".places">Places</a>
</li>
<li><a href="#filter" data-option-value=".things">Things</a>
</li>
</ul>
</nav>
<!-- End Filter -->
</div>
<div class="span9">
<div class="row">
<section id="projects">
<ul id="thumbs">
<!-- Item Project and Filter Name -->
<li class="item-thumbs span3 people">
<!-- Fancybox - Gallery Enabled - Title - Full Image -->
<a class="hover-wrap fancybox" data-fancybox-group="gallery" title="John" href="_include/img/work/full/people-01-full.jpg">
<span class="overlay-img"></span>
<span class="overlay-img-thumb font-icon-plus"></span>
</a>
<!-- Thumb Image and Description -->
<img src="_include/img/work/thumbs/people-01.jpg" alt="Print Number 1–10">
</li>
<!-- End Item Project -->
<!-- Item Project and Filter Name -->
<li class="item-thumbs span3 things">
<!-- Fancybox - Gallery Enabled - Title - Full Image -->
<a class="hover-wrap fancybox" data-fancybox-group="gallery" title="Garden Wall" href="_include/img/work/full/things-07-full.jpg">
<span class="overlay-img"></span>
<span class="overlay-img-thumb font-icon-plus"></span>
</a>
<!-- Thumb Image and Description -->
<img src="_include/img/work/thumbs/things-07.jpg" alt="Print Number 1–22">
</li>
<!-- End Item Project -->
JS
BRUSHED.filter = function() {
if ($('#projects').length > 0) {
var $container = $('#projects');
$container.imagesLoaded(function() {
$container.isotope({
// options
animationEngine: 'best-available',
itemSelector: '.item-thumbs',
layoutMode: 'fitRows'
});
});
// filter items when filter link is clicked
var $optionSets = $('#options .option-set'),
$optionLinks = $optionSets.find('a');
$optionLinks.click(function() {
var $this = $(this);
// don't proceed if already selected
if ($this.hasClass('selected')) {
return false;
}
var $optionSet = $this.parents('.option-set');
$optionSet.find('.selected').removeClass('selected');
$this.addClass('selected');
// make option object dynamically, i.e. { filter: '.my-filter-class' }
var options = {},
key = $optionSet.attr('data-option-key'),
value = $this.attr('data-option-value');
// parse 'false' as false boolean
value = value === 'false' ? false : value;
options[key] = value;
if (key === 'layoutMode' && typeof changeLayoutMode === 'function') {
// changes in layout modes need extra logic
changeLayoutMode($this, options)
} else {
// otherwise, apply new options
$container.isotope(options);
}
return false;
});
}
}
任何有识之士将不胜感激,请让我知道如果我需要提供任何信息。
谢谢!
嗨戴夫,我不能重现您提供的代码的问题。你有一个活的链接?我看到的一件事是,你必须为Fancybox的每个“画廊”赋予不同的名称。试试'data-fancybox-group =“gallery-01”'和'data-fancybox-group =“gallery-02”'等等。 –
嗨Louys,谢谢你回到我身边。这是该网站的当前测试版本:http://www.susanemiller.com/brushed/index.html –