1

I want to make an element horizontally collapsible. I've found a solution here: other stackoverflow post This is exactly what I want, but wit a little difference. I want my element to initially be in the collapsed state, and expand it by a button click. Any ideas?

edit: collapsible.animate(width: "toggle"}, 1000); Looks good ,the only problem is when my element is expanded, it should have display: inline-block instead of display: block what is the default set by .animate(width: "toggle"}

Community
  • 1
  • 1
ACs
  • 1,325
  • 2
  • 21
  • 39

1 Answers1

-1
$(element).animate({width: 'toggle'}, function() {
    $(this).css("display", "inline-block");
});
  • The problem with this solution is that the animation plays while `$(element)` being displayed as `block` and after the (false) animation ended, it changes to `inline-block`. And collapsing back not working this way for me. – ACs Feb 11 '16 at 11:42
  • 1
    Please add description to your answer. We are voting to delete this question because of its **length** and **content**. – Daniel Cheung Feb 11 '16 at 14:32