我正在调整此网站上的Responsly手风琴:http://dmmalam.github.io/Responsly.js/
这样可以正常工作,只不过这会在单击下一个元素时自动关闭前面的元素。我希望在单击下一个元素后保持每个元素处于打开状态,除非用户专门关闭了前一个元素。
(function( $ ){
$.fn.accordy = function( options ) {
var settings = $.extend({}, $.fn.accordy.defaults, options);
return this.each(function(index, container) {
//Add callback to (un)collpase
$(container).find('section hgroup').click(function(e) {
$(this).parent().siblings('section').removeClass('accordion_current');
$(this).parent().toggleClass('accordion_current');
e.preventDefault();
});
答案 0 :(得分:0)
经过反复试验,这可以通过从行
中取出accordion_content
来实现
$(this).parent().siblings('section').removeClass('accordion_content');