我的图库中有太多图像,我想替换“主要”的“全部”过滤器并在负载上显示它。 我已经尝试使用container.isotope filter ='。principal',但是在提货时没有显示任何内容,只有当我点击主体时它才显示过滤结果。
/* Portfolio Sorting */
jQuery(document).ready(function () {
(function ($) {
var container = $('section.portfolio_container');
function getNumbColumns() {
var winWidth = $(window).width(),
columnNumb = 1;
if (winWidth > 1500) {
columnNumb = 6;
} else if (winWidth > 1200) {
columnNumb = 5;
} else if (winWidth > 900) {
columnNumb = 4;
} else if (winWidth > 600) {
columnNumb = 3;
} else if (winWidth > 300) {
columnNumb = 2;
}
return columnNumb;
}
function setColumnWidth() {
var winWidth = $(window).width(),
columnNumb = getNumbColumns(),
postWidth = Math.floor(winWidth / columnNumb);
container.find('.portfolio').each(function () {
$(this).css( {
width : postWidth + 'px'
});
});
}
$('.gallerySelector .gallerySelectorList a').click(function () {
var selector = $(this).attr('data-filter');
$(this).parent().parent().find('> li.current').removeClass('current');
$(this).parent().addClass('current');
container.isotope( {
filter : selector
});
setTimeout(function () {
reArrangeProjects();
}, 300);
return false;
});
function reArrangeProjects() {
setColumnWidth();
container.isotope('reLayout');
}
container.imagesLoaded(function () {
setColumnWidth();
container.isotope( {
itemSelector : 'article.portfolio',
layoutMode : 'masonry',
resizable : false
} );
} );
$(window).on('debouncedresize', function () {
reArrangeProjects();
} );
} )(jQuery);
} );
/* DebouncedResize Function */
(function ($) {
var $event = $.event,
$special,
resizeTimeout;
$special = $event.special.debouncedresize = {
setup : function () {
$(this).on('resize', $special.handler);
},
teardown : function () {
$(this).off('resize', $special.handler);
},
handler : function (event, execAsap) {
var context = this,
args = arguments,
dispatch = function () {
event.type = 'debouncedresize';
$event.dispatch.apply(context, args);
};
if (resizeTimeout) {
clearTimeout(resizeTimeout);
}
execAsap ? dispatch() : resizeTimeout = setTimeout(dispatch, $special.threshold);
},
threshold : 150
};
} )(jQuery);
#folio {
background:url(../images/gallery-quote.png) center 80px no-repeat #111;
padding-top:100px;
clear: left;
}
.portfolio_container {
position:relative;
display:block;
overflow:hidden;
width:100%;
}
.portfolio_container .portfolio {
position:relative;
display:block;
float:left;
overflow:hidden;
width:25%;
height:auto;
}
.portfolio_container .portfolio .media_box figure a img {
display:block;
margin-left: auto;
margin-right: auto;
}
.portfolio_container .portfolio .media_box .hover_effect {
top:0;
left:0;
}
.gallerySelector {
background: #222;
height: 44px;
width: 100%;
margin-top: 20px;
}
.gallerySelectorList {
margin:0;
width: 100%;
}
.gallerySelectorList li {
float: left;
margin:0;
list-style:none;
width: 20%;
text-align: center;
padding: 0;
}
.gallerySelectorList li:hover {
background: #83103e;
}
.gallerySelectorList li a {
display:block;
padding:11px 0;
color: #fff;
text-decoration: none;
margin: 0;
transition:background-color 0.3s ease, color 0.2s ease;
}
.gallerySelectorList li.current {
background: #7b133c;
}
.portfolio_container .portfolio {
width: 20%;
}
.fullwidth {
display: block;
max-width: 100%;
min-width: 100%;
}
#gallery h3 {
margin-bottom: 20px;
}
.project-title {
font-family: 'Oswald', sans-serif;
font-size: 12px;
text-transform: uppercase;
margin-top: 7px;
}
.project-description {
color: #868991;
font-size: 10px;
text-transform: uppercase;
font-weight: 600;
margin: 0 0 20px 0;
}
.columns .overlay-content.loupe {
width: 34px;
height: 34px;
background: url(../../../templates/images/loupe.png) 0px 0px no-repeat;
position: absolute;
top: 22%;
margin: -17px 0 0 -17px;
left: 50%;
z-index: 10;
}
.thumbLink {
display: block;
width: 100%;
}
.thumbImage {
float: left;
position: relative;
overflow: hidden;
display: block;
margin-bottom: 0px;
box-sizing: border-box;
text-align: center;
width: 100%;
height: 100%;
}
.thumbImage img{
transition: all 0.7s ease-in-out;
}
.thumbImage .thumbText h3 {
margin-bottom: 10px;
padding-top: 10px;
border-bottom: 1px solid #fff;
transition: all 1s ease-in-out;
}
.thumbImage .thumbText p {
margin-bottom: 10px;
color: #fff;
transition: all 1s ease-in-out;
}
.thumbImage .thumbTextWrap {
position: absolute;
top: 0;
height: 100%;
padding: 0 20px;
opacity: 0;
background: #7b133c;
text-align: center;
transition: all 1s ease-in-out;
}
.ie8 .thumbImage .thumbTextWrap {
display:none;
}
.thumbImage .thumbTextWrap:before {
content: '';
display: inline-block;
height: 100%;
vertical-align: middle;
margin-right: -0.5em; /* Adjusts for spacing */
}
.thumbText {
text-align: center;
transform: scale(0);
transition: all 0.7s ease-in-out;
display: inline-block;
vertical-align: middle;
width: 90%;
}
.thumbImage:hover img {
opacity: 0;
transform: scale(10);
}
.thumbImage:hover .thumbTextWrap {
opacity: 1;
}
.ie8 .thumbImage:hover .thumbTextWrap {
display: block;
}
.thumbImage:hover .thumbText {
transform: scale(1);
}
.thumbLink {
background:url(../images/icons/icon-magnify.png) center center no-repeat #fff;
width: 30px;
height: 30px;
border-radius: 15px;
opacity: 0.5;
margin: 0 auto;
}
.thumbLink:hover {
opacity: 1;
}
.portfolioBottom {
background: #222;
height: 44px;
width: 100%;
clear: left;
}
<div id="folio" class="page section">
<div class="container">
<div class="sixteen columns">
<h1>Portifólio</h1>
<h3><span class="small">Those who do</span> <span class="smallBold">not want to</span>
<br><span class="largeBold">imitate</span> <span class="large">anything,</span>
<br><span class="medium">produce</span><span class="mediumBold"> nothing.</span>
<br><span class="author">Salvador Dali</span></h3>
</div>
</div>
<div class="gallerySelector">
<ul class="gallerySelectorList">
<li class="current"><a data-filter="article.portfolio[data-category~='principal']" href="#">principal</a></li>
<li><a data-filter="article.portfolio[data-category~='redacao']" href="#">Redação</a></li>
<li><a data-filter="article.portfolio[data-category~='criacao']" href="#">Redação-Criação</a></li>
<li><a data-filter="article.portfolio[data-category~='social']" href="#">Social Media</a></li>
<li><a data-filter="article.portfolio[data-category~='video']" href="#">Audiovisual</a></li>
</ul>
</div>
<section class="portfolio_container">
<article class="portfolio" data-category="principal">
<section class="thumbImage">
<img src="images/gallery/t-rec1.jpg" alt="" class="fullwidth">
<div class="thumbTextWrap">
<div class="thumbText">
<h3 class="sectionTitle">Gallery Item</h3>
<p>Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. </p>
<a class="thumbLink" href="images/gallery/rec1.jpg" rel="prettyPhoto[gallery1]" title="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas ac augue at erat hendrerit dictum."></a>
</div>
</div>
</section>
</article>
<article class="portfolio" data-category="rincipal">
<section class="thumbImage">
<img src="images/gallery/t-rec2.jpg" alt="" class="fullwidth">
<div class="thumbTextWrap">
<div class="thumbText">
<h3 class="sectionTitle">Gallery Item</h3>
<p>Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. </p>
<a class="thumbLink" href="images/gallery/rec2.jpg" rel="prettyPhoto[gallery1]" title="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas ac augue at erat hendrerit dictum."></a>
</div>
</div>
</section>
</article>
<article class="portfolio" data-category="principal">
<section class="thumbImage">
<img src="images/gallery/t-rec3.jpg" alt="" class="fullwidth">
<div class="thumbTextWrap">
<div class="thumbText">
<h3 class="sectionTitle">Gallery Item</h3>
<p>Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. </p>
<a class="thumbLink" href="images/gallery/rec3.jpg" rel="prettyPhoto[gallery1]" title="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas ac augue at erat hendrerit dictum."></a>
</div>
</div>
</section>
</article>
<article class="portfolio" data-category="redacao criacao">
<section class="thumbImage">
<img src="images/gallery/t-rec4.jpg" alt="" class="fullwidth">
<div class="thumbTextWrap">
<div class="thumbText">
<h3 class="sectionTitle">Gallery Item</h3>
<p>Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. </p>
<a class="thumbLink" href="images/gallery/rec4.jpg" rel="prettyPhoto[gallery1]" title="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas ac augue at erat hendrerit dictum."></a>
</div>
</div>
</section>
</article>
<article class="portfolio" data-category="redacao criacao">
<section class="thumbImage">
<img src="images/gallery/t-rec5.jpg" alt="" class="fullwidth">
<div class="thumbTextWrap">
<div class="thumbText">
<h3 class="sectionTitle">Gallery Item</h3>
<p>Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. </p>
<a class="thumbLink" href="images/gallery/rec5.jpg" rel="prettyPhoto[gallery1]" title="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas ac augue at erat hendrerit dictum."></a>
</div>
</div>
</section>
</article>
<article class="portfolio" data-category="redacao criacao">
<section class="thumbImage">
<img src="images/gallery/t-rec6.jpg" alt="" class="fullwidth">
<div class="thumbTextWrap">
<div class="thumbText">
<h3 class="sectionTitle">Gallery Item</h3>
<p>Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. </p>
<a class="thumbLink" href="images/gallery/rec6.jpg" rel="prettyPhoto[gallery1]" title="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas ac augue at erat hendrerit dictum."></a>
</div>
</div>
</section>
</article>
<article class="portfolio" data-category="video">
<section class="thumbImage">
<img src="images/gallery/videothumb.png" alt="" class="fullwidth">
<div class="thumbTextWrap">
<div class="thumbText">
<h3 class="sectionTitle">Gallery Item</h3>
<p>Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. </p>
<a class="thumbLink" href="http://youtu.be/3UkU2I7OVB4" rel="prettyPhoto" title="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas ac augue at erat hendrerit dictum."></a>
</div>
</div>
</section>
</article>
<article class="portfolio" data-category="redacao criacao">
<section class="thumbImage">
<img src="images/gallery/t-rec7.jpg" alt="" class="fullwidth">
<div class="thumbTextWrap">
<div class="thumbText">
<h3 class="sectionTitle">Gallery Item</h3>
<p>Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. </p>
<a class="thumbLink" href="images/gallery/rec7.jpg" rel="prettyPhoto[gallery1]" title="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas ac augue at erat hendrerit dictum."></a>
</div>
</div>
</section>
</article>
<article class="portfolio" data-category="redacao criacao">
<section class="thumbImage">
<img src="images/gallery/t-rec8.jpg" alt="" class="fullwidth">
<div class="thumbTextWrap">
<div class="thumbText">
<h3 class="sectionTitle">Gallery Item</h3>
<p>Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. </p>
<a class="thumbLink" href="images/gallery/rec8.jpg" rel="prettyPhoto[gallery1]" title="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas ac augue at erat hendrerit dictum."></a>
</div>
</div>
</section>
答案 0 :(得分:0)
完成!所有必须做的是,而不是过滤器:'。principal'我必须使用
filter: "article.portfolio[data-category~='principal']"
weeeeeeeee o / o / o // oo /