[英]Isotope updating to V2, how to toggle size and layot
http://bit.ly/19GXxDy下过滤器的等部分,有一个肘节大小的功能。 以此为基础,我们制作了一个页面作为基本示例,以构建带有投资组合矢量徽标的HTML页面,使用站点示例升级到V2失败。 我们使用错误的方法吗?
发生了什么变化,我们在做什么错。 我们正在尝试升级到V2,但无法在V2中使用相同的切换图块大小,
// V1 toggle variable sizes of all elements
$('#toggle-sizes').find('a').click(function(){
$container
.toggleClass('variable-sizes')
.isotope('reLayout');
return false;
});
// in V2 change size of all item by toggling class, doesnt work
$container.on( 'click', function() {
$(this).toggleClass('variable-sizes');
$container.isotope('layout');
});
我假设您在代码中定义了变量$ container? 您的v2代码似乎正在发生的事情是,您单击$ container,在$ container本身上切换类“ variable-sizes”,即代码中的$(this),而不是链接“ a”。
您想改为这样做:
$container.on( 'click','a', function() {
$(this).toggleClass('variable-sizes');
$container.isotope('layout');
});
jsfiddle中的代码示例将更有助于回答您的问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.