我使用twitter bootstrap在页面上制作手风琴。我想在每个页面上打开第一个面板。这是我写的代码:Twitter bootstrap使手风琴的第一个面板默认打开
var accordion_list = $(".prime-content .accordion-body");
accordion_list.each(function(index, element){
accordion_list.addClass(index == 0 ? "in" : "");
});
但是,这是为所有元素添加“in”类。什么需要解决?
使用像eq(),find(),first-child这样的东西,它会解决你的问题,我认为 – SVS 2012-08-01 07:15:45