通过向信息框添加类解决了我的问题:
{{Infobox
| abovestyle = background:#cfc;
| above = Infobox
| image = [[File:Parents.jpg|300px]]
|header1 = Header 1
|rowclass1 = class1 header hidden
|label2 = 111
|data2 = test1
|rowclass2 = class1
|header3 = Header 3
|rowclass3 = class3 header hidden
|label4 =
|data4 = data 4
|rowclass4 = class3
}}
然后我将此 jQuery 代码添加到我的 Common.js 中:
$('<a class="infoboxtoggle" href="#">+/-</a>').appendTo(
$('.infobox tr.header').filter(function(){ return $(this).attr('class').split(" ").length > 1 }).find("th")
);
$(".infobox tr.header").each(function(){
var $this = $(this);
if( $this.hasClass("hidden") ){
var firstclass = $this.attr("class").split(" ")[0];
$this.siblings("." + firstclass).addClass("hidden");
}
});
$('a.infoboxtoggle').click (
function (infoboxtoggle)
{
var parent = $(this).parent ();
var grandparent = parent.parent ();
var firstclass = grandparent.attr ('class').split(" ")[0];
infoboxtoggle.preventDefault();
grandparent.siblings ('.' + firstclass).has ('td').toggleClass ('hidden');
}
);
然后添加了一些css:
a.infoboxtoggle { float: right; } /* positions the +/- */
.hidden { display: none; } /* hides hidden rows */
tr.header.hidden { display: table-row; } /* does _not_ hide headers */
然后它起作用了:

当您按下 +/- 时,它会展开隐藏的行。