alexander-ruehle/paper-collapse

only allow one card to be expanded

Opened this issue · 5 comments

jmls commented

it would be great to be able to specify that a card belongs within a group, and only one card at a time can be expanded (ie clicking on another card in the group will expand that card, and shrink any other expanded card)

something along the lines of

<div class="collapse-card" card-group="foo" card-single-expand>

Find this code in paper-collapse.min.js:
onShow:function(){}

Replace with this:
onShow:function(){$('.collapse-card').removeClass('active');$('.collapse-card__body').css('display','none')}

@davidecasadei That code won't work for me. When I copy/paste that code into my .js file the card wil close right after it is opened. Have you found a way to only close a card when an other one is opened?

@alexander-ruehle I was hoping you might have an solution to this problem. Have you found out a way to make it work?

$('.collapse-card').paperCollapse({ onShow: function(){ $('.collapse-card.active').not(this).removeClass('active').find('.collapse-card__body').slideUp(); } });