同位素附加问题 [英] Issues with isotope appending
本文介绍了同位素附加问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
http://isotope.metafizzy .co / docs / methods.html#追加
如果我像这样调用附件
<$点击(function(){
val ='< div class =content-box masonry-brick img11>< a href =#>< img src =images / 1.jpgstyle =width:290px; height:163.36666666666667px;>< div class =portfolio-more>< div class =portfolio-icon>< / div>< / div>< / a>< div class =content-box-content>< h3 class =post-info> / People< / h3>< h2> Street Life< / h2>< / div>< / div>';
var $ container = $('#grid-gallery');
$ container.isotope('append',val)
return false;
});
然后同位素吐出下面的错误消息:
[content] has no method'filter'
如果我添加定位到div,那么它工作正常,除了新的元素被加载到该位置,并保持不变。
解决方案
Change:
$ container.isotope('attached',val);
$ container.isotope('append',$(val));
或者你可以这样做,如果你希望它更清洁....
$('#loadMore')。click(function(){
$ b $ val = $('< div class = content-box masonry-brick img11>< a href =#>< img src =images / 1.jpgstyle =width:290px; height:163.36666666666667px;>< div class =portfolio-more>< div class =portfolio-icon>< / div>< / div>< / a>< div class =content-box-content> < h3 class =post-info>生活方式/人物< / h3>< h2>街头生活< / h2>< / div>< / div>');
var $ container = $('#grid-gallery');
$ container.isotope('insert',val);
return false;
});
I am using isotope to build a smooth grid gallery. Currently I am having issues with the append feature: http://isotope.metafizzy.co/docs/methods.html#appended
If I call the append like this
$('#loadMore').click(function(){
val='<div class="content-box masonry-brick img11"><a href="#"><img src="images/1.jpg" style="width: 290px; height: 163.36666666666667px; "><div class="portfolio-more"><div class="portfolio-icon"></div></div></a><div class="content-box-content"><h3 class="post-info">Lifestyle / People</h3><h2>Street Life</h2></div></div>';
var $container = $('#grid-gallery');
$container.isotope( 'appended', val)
return false;
});
Then isotopes spits out the following error msg:
[content] has no method 'filter'
If I add positioning to the div, then it works fine, except the new element is loaded to that position and remains fixed.
解决方案
Change:
$container.isotope( 'appended', val);
To
$container.isotope( 'append', $(val) );
Or you could do this if you want it cleaner....
$('#loadMore').click(function(){
val= $('<div class="content-box masonry-brick img11"><a href="#"><img src="images/1.jpg" style="width: 290px; height: 163.36666666666667px; "><div class="portfolio-more"><div class="portfolio-icon"></div></div></a><div class="content-box-content"><h3 class="post-info">Lifestyle / People</h3><h2>Street Life</h2></div></div>');
var $container = $('#grid-gallery');
$container.isotope( 'insert', val );
return false;
});
这篇关于同位素附加问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文