Question

I'm adapting the Responsly accordion from this site :http://dmmalam.github.io/Responsly.js/

This is working fine except that this automatically closes the preceding element when the next one is clicked. I want to keep each element open after the next one is clicked, unless the user specifically closes that preceding element.

(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();
  });
Was it helpful?

Solution

after trial and error, this worked by taking out accordion_content from the line

    $(this).parent().siblings('section').removeClass('accordion_content');
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top