alexander-ruehle / paper-collapse

Collapsible paper cards.
http://bbo-code.com/components/paper-collapse
163 stars 60 forks source link

only allow one card to be expanded #8

Open jmls opened 9 years ago

jmls commented 9 years ago

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>
julienhoste commented 9 years ago

+1

davidecasadei commented 8 years ago

+1

davidecasadei commented 8 years ago

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')}

KayvandenHeuvel commented 8 years ago

@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?

wesleymacente commented 8 years ago

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