我正在使用这个插件
http://www.jqueryscript.net/layout/Responsive-Equal-Height-Plugin-with-jQuery-ResponsibleHeight.html
但我不知道如何让“孩子”成为多个班级。
这是初始化插件的代码。这里有人已经使用过这个插件吗?我复制并粘贴代码并将不同的类放在“child”下,但它有点多余。有没有什么方法可以减少代码而不会反复使用相同的代码?
谢谢!
//Initialise the plugin
$('.item-container div').responsibleHeight({
delay: 0,
child: '.filter',
widths: [
[1300, 10],
[1000, 8],
[700, 4],
[40, 2],
[0, 1]
]
});
//Destroy the plugin, remove heights and stop working on resize
$('.destroy').click(function(){
$('.item-container div').responsibleHeight('destroy')
});
//Reinitialise the plugin
$('.reinit').click(function(){
$('.item-container div').responsibleHeight('reinit')
});
答案 0 :(得分:0)
是否要选择具有多个类的项目或具有不同类别的多个项目?
如果代码如下所示:
child: '.filter',
//这可能不起作用 - 此插件允许您只选择一个孩子
如果你想选择少数类之一的子代,代码将如下所示:(只需用逗号分隔类)
child: '.filter, .class2, .class3',
或者如果您想选择具有多个类的项目:(一个接一个地列出类别)
child: '.filter.class2.class3',
希望它会对你有所帮助:)。